CTANZ / moodle-theme_decaf

Moodle 2 theme - decaf
https://github.com/leizhang/moodle-theme_decaf/wiki/
17 stars 17 forks source link

Support custommenuitems #23

Closed danmarsden closed 5 years ago

danmarsden commented 9 years ago

Hey Paul,

any thoughts on adding support for decaf child themes to have their own custommenuitems? - I have a child theme based on decaf but I don't really want to copy the layout/nav files into the child theme if I can avoid it. More info on custommenuitems is here: https://tracker.moodle.org/browse/MDL-31043

here's a possible patch:

diff --git a/theme/decaf/layout/navbar.inc.php b/theme/decaf/layout/navbar.inc.php
index 7dae360..6e769f8 100644
--- a/theme/decaf/layout/navbar.inc.php
+++ b/theme/decaf/layout/navbar.inc.php
@@ -43,7 +43,11 @@ $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custom
             </a>
             <div class="nav-collapse collapse">
                 <?php if ($hascustommenu && empty($decaf->custommenuinawesomebar)) {
-                    echo $OUTPUT->custom_menu();
+                    if (isset($PAGE->theme->settings->custommenuitems)) {
+                        echo $OUTPUT->custom_menu($PAGE->theme->settings->custommenuitems);
+                    } else {
+                        echo $OUTPUT->custom_menu();
+                    }
                 } ?>
                 <ul class="nav pull-right">
                     <li><?php echo $OUTPUT->page_heading_menu(); ?></li>
pauln commented 9 years ago

Hi Dan, Sure, sounds like a good idea - want to submit a pull request?