split footer module into static and dynamic blocks
authorAndrew Engelbrecht <andrew@fsf.org>
Thu, 18 Jul 2019 14:58:43 +0000 (10:58 -0400)
committerAndrew Engelbrecht <andrew@fsf.org>
Thu, 18 Jul 2019 14:58:43 +0000 (10:58 -0400)
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
modules/footer/src/Plugin/Block/FooterBlock.php
modules/footer/templates/footer.html.twig

index 7ad9ddb78452e487d44d64ec549582a834f35218..6f3d4b93f96ba8aa5cc42b4e19abe2cf8d279b55 100644 (file)
@@ -11,7 +11,7 @@
 function footer_theme($existing, $type, $theme, $path) {
   return [
     'footer' => [
-      'variables' => ['menu_array' => NULL ]
+      'variables' => []
     ],
 
   ];
index 426cd82d42b26624165039900ef4391ee24f179b..413dca6243d26a37055642cc1518de480fd681ae 100644 (file)
@@ -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',
index 98c6924da8ebab7b1b0e78b0a76a64c8fa9c2111..91c215f61930113773bb3e5a184128b9e37de9f7 100644 (file)
@@ -1,42 +1,3 @@
-<div class="container">
-<div class="col-md-4">
-<div class="ryf-footer">
-<img alt="Free Software Foundation" class="img-responsive" id="fsf-logo-footer" src="/themes/custom/ryf/images/fsf-logo.svg" />
-<p>The Free Software Foundation (FSF) is a nonprofit with a worldwide mission to promote computer user freedom.</p>
-
-<p>We defend the rights of all software users. (<a href="//fsf.org">Read more</a>)</p>
-</div>
-</div>
-
-<div class="col-md-offset-2 col-md-3">
-<div class="campaigns">
-<h4>Campaigns</h4>
-
-<ul>
-       <li><a href="/campaigns/priority-projects/">High Priority Free Software Projects</a></li>
-       <li><a href="/campaigns/freejs/">Free JavaScript</a></li>
-       <li><a href="/campaigns/campaigns/secure-boot-vs-restricted-boot/">Secure Boot vs Restricted Boot</a></li>
-       <li><a href="https://www.gnu.org/">GNU Operating System</a></li>
-       <li><a href="https://defectivebydesign.org/">Defective by Design</a></li>
-       <li><i><a href="https://www.fsf.org/campaigns">See all campaigns</a></i></li>
-</ul>
-</div>
-<!-- .campaigns --></div>
-
-<div class="col-md-3">
-<div class="get-involved">
-<h4>Get Involved</h4>
-
-<ul>
-       {% for this_menu in menu_array %}
-               <li>
-                       <a class="footer-link" href="{{ this_menu.url }}">{{ this_menu.title }}</a>
-               </li>
-       {% endfor %}
-</ul>
-</div>
-<!-- .get-involved --></div>
-</div>
 
 <div class="container copyright">
        <p>Send your feedback on our translations and new translations of pages to <a href="mailto:campaigns@fsf.org">campaigns@fsf.org</a>.</p>