From 03a450b2801b7497d3a0de55e899d051f6d2b428 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Thu, 18 Jul 2019 10:58:43 -0400 Subject: [PATCH] split footer module into static and dynamic blocks the part of the footer with the list of links has been split into a static block. the part of the footer with the copyright information has been kept in the dynamic block. this should make it easier for staff to edit the static block. --- modules/footer/footer.module | 2 +- .../footer/src/Plugin/Block/FooterBlock.php | 25 ------------ modules/footer/templates/footer.html.twig | 39 ------------------- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/modules/footer/footer.module b/modules/footer/footer.module index 7ad9ddb..6f3d4b9 100644 --- a/modules/footer/footer.module +++ b/modules/footer/footer.module @@ -11,7 +11,7 @@ function footer_theme($existing, $type, $theme, $path) { return [ 'footer' => [ - 'variables' => ['menu_array' => NULL ] + 'variables' => [] ], ]; diff --git a/modules/footer/src/Plugin/Block/FooterBlock.php b/modules/footer/src/Plugin/Block/FooterBlock.php index 426cd82..413dca6 100644 --- a/modules/footer/src/Plugin/Block/FooterBlock.php +++ b/modules/footer/src/Plugin/Block/FooterBlock.php @@ -26,33 +26,8 @@ class FooterBlock extends BlockBase implements BlockPluginInterface { */ public function build() { - $menu_tree_parameters = new MenuTreeParameters(); - $tree = \Drupal::menuTree()->load('footer', $menu_tree_parameters); - - $cc = 0; - foreach($tree as $menu){ - $title = $menu->link->getTitle(); - $urlObject = $menu->link->getUrlObject(); - $url = $urlObject->toString(); - $weight = $menu->link->getWeight(); - $enabled = $menu->link->isEnabled(); - - if($enabled) { - $menu_array[$cc]['title'] = $title; - $menu_array[$cc]['url'] = $url; - $menu_array[$cc]['weight'] = $weight; - $cc++; - } - - } - - usort($menu_array, function($a, $b) { - return $a['weight'] - $b['weight']; - }); - return array( '#theme' => 'footer', - '#menu_array' => $menu_array, '#attached' => array( 'library' => array( 'footer/footer', diff --git a/modules/footer/templates/footer.html.twig b/modules/footer/templates/footer.html.twig index 98c6924..91c215f 100644 --- a/modules/footer/templates/footer.html.twig +++ b/modules/footer/templates/footer.html.twig @@ -1,42 +1,3 @@ -
-
- -
- - - -
-
-

Get Involved

- - -
-
-