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

Boost flat navigation may unintentionally indent nodes.

    XMLWordPrintable

    Details

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

      **You are going to want a plugin that you can modify. Use a glossary for example.

      1. Set the Moodle theme to Boost
      2. Create a course and enter the course.
      3. Create a glossary in the course and go to the glossary you just created
      4. Modify the implementation of the function glossary_extend_navigation to the following

      function glossary_extend_navigation($navigation, $course, $module, $cm) {
          $node = $navigation->create('This is a test for MDL-60653', 'http://test.test', \navigation_node::TYPE_CUSTOM, null, 0);
          $node->showinflatnavigation = true;
          $navigation->add_node($node);
      }
      

      # Visit the glossary you created at step 3

      1. Verify that the node shows up in the flat navigation menu of Boost.
      2. Verify that the node is not indented. It should look like after.png and not like before.png.

       

      Show
      **You are going to want a plugin that you can modify. Use a glossary for example. Set the Moodle theme to Boost Create a course and enter the course. Create a glossary in the course and go to the glossary you just created Modify the implementation of the function glossary_extend_navigation to the following function glossary_extend_navigation($navigation, $course, $module, $cm) { $node = $navigation->create( 'This is a test for MDL-60653' , 'http://test.test' , \navigation_node::TYPE_CUSTOM, null , 0 ); $node->showinflatnavigation = true ; $navigation->add_node($node); } # Visit the glossary you created at step 3 Verify  that the node shows up in the flat navigation menu of Boost. Verify that the node is not indented. It should look like after.png and not like before.png.  
    • Workaround:
      Hide

      The work around is to always assign string keys to navigation nodes.

      Show
      The work around is to always assign string keys to navigation nodes.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull 3.4 Branch:
    • Pull Master Branch:
      MDL-60653-master

      Description

      On line 437 of lib/navigationlib.php the double equal comparison is used to compare text strings instead of the triple equal.  This means if the key is an integer and equal to 0, then the node will be indented because 0 is equal to "courseindexpage".  It should be noted that the navigation library defaults to using integers, starting with 0, if no key value is assigned.

      There is a work around: Set the "key" value for the node to a string value.

        Attachments

        1. after.png
          after.png
          17 kB
        2. before.png
          before.png
          17 kB

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jan/18