Moodle
  1. Moodle
  2. MDL-26423

Add option so that format_text (with htmlpurifier) does not remove id attribute

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Libraries
    • Labels:
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      With htmlpurifier enabled, format_text removes the 'id' attribute. This causes a problem for the ouwiki module, which uses id to store data associated with the user content.

      I propose to change format_text to add a new option

      allowid = true (default false); allow the id attribute to be preserved even when cleaning is applied

      If set, this will pass through eventually to HTMLPurifier as
      $config->set('HTML.EnableAttrID', true)

      (When htmlpurifier is not enabled, there is no need to pass it through to the 'old' cleaning method, as that one does not remove id attribute anyway)

      Petr has agreed this is a reasonable approach and we can submit a PULL request for 2.0.3, subject to review.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Sam Marshall added a comment -

            added pull request PULL-366 ready for review (whenever, no rush)

            Show
            Sam Marshall added a comment - added pull request PULL-366 ready for review (whenever, no rush)
            Hide
            Helen Foster added a comment -

            Thanks again Sam.

            Show
            Helen Foster added a comment - Thanks again Sam.

              People

              • Assignee:
                Sam Marshall
                Reporter:
                Sam Marshall
                Tester:
                Eloy Lafuente (stronk7)
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: