Moodle
  1. Moodle
  2. MDL-25447

Custom menu breaks when nested deeper than 2 levels

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.1
    • Component/s: General, Navigation
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      1157

      Description

      Custom menu breaks when nested deeper than 2 levels.

      Test menu structure to show the issue

      FIRST

      • menu1.1
        SECOND
      • menu2.1
      • menu2.2
        • menu2.2.1
          • menu2.2.1.1
            THIRD
      • menu3.1

      In line 2346 in the function "convert_text_to_menu_nodes($text)" "$depth = $lastdepth - 1;" depth step back is hard coded to 1 step. That does not work when nesting is more than 2 steps and you need to go back to root.

        Activity

        Hide
        Sam Hemelryk added a comment -

        Thanks for spotting that Urs, I've just attached a patch that fixes that bug by properly recursing the tree rather than assuming movement of one.

        Petr or Martin could you please review this patch for me?

        Cheers
        Sam

        Show
        Sam Hemelryk added a comment - Thanks for spotting that Urs, I've just attached a patch that fixes that bug by properly recursing the tree rather than assuming movement of one. Petr or Martin could you please review this patch for me? Cheers Sam
        Hide
        Petr Škoda added a comment -

        +1

        Show
        Petr Škoda added a comment - +1
        Hide
        Sam Hemelryk added a comment -

        Thanks for the review Petr, I've commit the patch now.
        Thanks for spotting the bug and reporting it Urs, it will now be fixed in 2.0.1.

        Cheers
        Sam

        Show
        Sam Hemelryk added a comment - Thanks for the review Petr, I've commit the patch now. Thanks for spotting the bug and reporting it Urs, it will now be fixed in 2.0.1. Cheers Sam

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: