From f70e6dfb354ed601131e23a7a46e5f0035e536b2 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Mon, 15 Jul 2019 14:39:32 -0400 Subject: [PATCH] Revert "use a static footer block instead of a dynamic one" This reverts commit 31fd2207757495e4a40089582b6488c19f8ab92d. Bringing back the dynamic footer. There are some advantages to having a dynamic footer, the supposed advantages of using a static footer were not all that great, and the Drupal bug that caused errors due to the missing footer are all reasons to switch back to the dynamic footer. --- modules/footer/css/footer.css | 12 ++++ modules/footer/footer.info.yml | 8 +++ modules/footer/footer.libraries.yml | 7 ++ modules/footer/footer.module | 18 ++++++ modules/footer/js/footer.js | 5 ++ .../footer/src/Plugin/Block/FooterBlock.php | 64 +++++++++++++++++++ modules/footer/templates/footer.html.twig | 49 ++++++++++++++ 7 files changed, 163 insertions(+) create mode 100644 modules/footer/css/footer.css create mode 100644 modules/footer/footer.info.yml create mode 100644 modules/footer/footer.libraries.yml create mode 100644 modules/footer/footer.module create mode 100644 modules/footer/js/footer.js create mode 100644 modules/footer/src/Plugin/Block/FooterBlock.php create mode 100644 modules/footer/templates/footer.html.twig diff --git a/modules/footer/css/footer.css b/modules/footer/css/footer.css new file mode 100644 index 0000000..5fd09fe --- /dev/null +++ b/modules/footer/css/footer.css @@ -0,0 +1,12 @@ +/* Footer */ + +.footer { + color: #FFF; + border: none !important; +} +.footer a { color: #729fcf; } +.footer a:hover { color: #FFF; } +.footer h4 { font-weight: bold; } +.footer li { list-style: none; line-height: 1.5em; } +.footer .copyright { font-size: 0.9em; text-align: center; width: 80%; margin-top: 1em; border-top: 1px solid #111; padding: 1em; } + diff --git a/modules/footer/footer.info.yml b/modules/footer/footer.info.yml new file mode 100644 index 0000000..47d83d4 --- /dev/null +++ b/modules/footer/footer.info.yml @@ -0,0 +1,8 @@ +name: Footer +description: Footer +core: 8.x +package: RYF Custom Module +dependencies: +- node +- block +type: module diff --git a/modules/footer/footer.libraries.yml b/modules/footer/footer.libraries.yml new file mode 100644 index 0000000..02b8c58 --- /dev/null +++ b/modules/footer/footer.libraries.yml @@ -0,0 +1,7 @@ +footer: + css: + theme: + css/footer.css: {} + js: + js/footer.js: {} + diff --git a/modules/footer/footer.module b/modules/footer/footer.module new file mode 100644 index 0000000..7ad9ddb --- /dev/null +++ b/modules/footer/footer.module @@ -0,0 +1,18 @@ + [ + 'variables' => ['menu_array' => NULL ] + ], + + ]; +} diff --git a/modules/footer/js/footer.js b/modules/footer/js/footer.js new file mode 100644 index 0000000..1143d61 --- /dev/null +++ b/modules/footer/js/footer.js @@ -0,0 +1,5 @@ +(function($){ + $(document).ready(function(){ + }); + +})(jQuery); diff --git a/modules/footer/src/Plugin/Block/FooterBlock.php b/modules/footer/src/Plugin/Block/FooterBlock.php new file mode 100644 index 0000000..426cd82 --- /dev/null +++ b/modules/footer/src/Plugin/Block/FooterBlock.php @@ -0,0 +1,64 @@ +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 new file mode 100644 index 0000000..18cc55f --- /dev/null +++ b/modules/footer/templates/footer.html.twig @@ -0,0 +1,49 @@ +
+
+ +
+ + + +
+
+

Get Involved

+ + +
+
+
+ + + -- 2.25.1