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

Custom menu output broken with urltolink filter enabled

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1, 2.2
    • Fix Version/s: 2.0.4, 2.1.1
    • Component/s: Filters
    • Labels:
    • Testing Instructions:
      Hide

      Testing for 2.0:

      • Multi-language custom menus not supported on 2.0. Reverting the previous buggy implementation. Just make sure the menu works as it used to.

      Testing for 2.1:

      • Install another language pack to the site (for example Czech - Čeština "cs")
      • Enable multi/language filter (content filtering is enough)
      • Go to Site administration > Appearance > Themes > Theme settings and define the custom menu using a multi-lang syntax (see comments below for some example using the English/Czech variants of the menu)
      • TEST: make sure that when switching the language, you get relevant custom menu displayed
      Show
      Testing for 2.0: Multi-language custom menus not supported on 2.0. Reverting the previous buggy implementation. Just make sure the menu works as it used to. Testing for 2.1: Install another language pack to the site (for example Czech - Čeština "cs") Enable multi/language filter (content filtering is enough) Go to Site administration > Appearance > Themes > Theme settings and define the custom menu using a multi-lang syntax (see comments below for some example using the English/Czech variants of the menu) TEST: make sure that when switching the language, you get relevant custom menu displayed
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-28168-custommenu

      Description

      This is one regression caused by MDL-27073.

      To reproduce:

      • Into any 2.0/2.1/master site enable the urtolink filter (active for MOODLE_FORMAT)
      • Define one custom menu with full links, mine was, for example:

      Switch to postgres|http://127.0.0.1/~stronk7/git?dbconfig=postgres
      Switch to mssql|http://127.0.0.1/~stronk7/git?dbconfig=mssql
      Switch to oracle|http://127.0.0.1/~stronk7/git?dbconfig=oracle
       
      Debug config|http://127.0.0.1/~stronk7/git?debugconfig
      (using db mysql, git branch MOODLE_21_STABLE, based on master)|

      • Take a look to the custom menu generated, all the links are borked. The cause is the urltolink detecting those URLs (because we changed to format_text()) and putting them within <a> tags, completely breaking the process.

      Note this affects every site using custom menus and having that filter enabled for the MOODLE_FORMAT.

      Workarounds: Disable the filter or make it not to process MOODLE_FORMAT (but it's one of the logical formats to process).

      Possible fixes:

      1) Programatically enclose the links under <nolink> sections before calling format_text()
      2) Change the format in the call from FORMAT_MOODLE to another less suitable to have that filter enabled (FORMAT_HTML?).
      3) Change the the format_text() call to format_string(), set the urltolink filter to process only contents (not strings) and require to enable filterall.

      My +1 goes to 1) above. Ciao

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    1/Aug/11