Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-58174

Theme Boost: Make private function build_action_menu_from_navigation() protected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.3
    • Fix Version/s: 3.2.5, 3.3.2
    • Component/s: Themes
    • Labels:
    • Testing Instructions:
      Hide

      It is not possible to test this bugfix manually in a plain Moodle installation because the function declaration works fine in Boost and you would have to create a Boost child theme to test this.

      Show
      It is not possible to test this bugfix manually in a plain Moodle installation because the function declaration works fine in Boost and you would have to create a Boost child theme to test this.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58174-master

      Description

      Hi,

      while working on a child theme for your latest theme Boost, I encountered a problem by overrding renderers for my child theme.

      My goal is to keep it the old way:

      • In the own renderer.php file I only need to copy the function I want to add changes to.
      • All other functions will be called from the base theme or Moodle core.

      With Boost child theme, this is generally possible by extending the core_renderer from the correct namespace.

      But here is still a problem:
      The overridden function context_header_settings_menu() calls the PRIVATE function build_action_menu_from_navigation(action_menu $menu, navigation_node $node, $indent = false, $onlytopleafnodes = false). Because this called function is private, it is simply not possible to call it from outside the overridden core_renderer.php and will lead to an error message.
      To make the code working again, this function has to be copied into the overridden core_renderer.php. Unfortunately this is only a workaround that results in a maintenance overhead when Boost code will be updated (see also this forum discussion: https://moodle.org/mod/forum/discuss.php?d=348672).

      Solution:
      Making the parent function build_action_menu_from_navigation(...) PROTECTED makes it possible to call the parent function from Boost itself. So the overridden renderer file will only have really overridden functions inside and this is the status as it should be.

      I don't know if there's a reason why this function is made private, but I hope you can change it to restore the intended way of working with renderers.

      Thanks in advance and cheers, Kathrin

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Sep/17