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

Inconsistent referencing of 'render_from_template' in 'core_renderer'.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.9.3, 3.0, 3.1
    • Fix Version/s: None
    • Component/s: Themes
    • Labels:
    • Workaround:
      Hide

      None.

      Show
      None.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE

      Description

      In the 'core_renderer' class defined in '/lib/outputrenderers.php' the method 'render_from_template' is defined as:

      public function render_from_template($templatename, $context) {
      

      and therefore override-able. In the same class the method 'render_pix_icon' calls it with the line:

      return $this->render_from_template('core/pix_icon', $data);
      

      and the method 'render_notification' calls it with the line:

      return self::render_from_template($templatename, $data);
      

      therefore if 'render_from_template' was ever overridden then 'render_pix_icon' would call the overridden version but 'render_notification' would not because of the use of '$this' to refer to the object instance (hence inheritance and vtables etc) and 'self' to refer to the class. This is inconsistent and would cause a headache of oddity wonder.

      Depending on policy they need to be both either '$this' or 'self'.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            gb2048 Gareth J Barnard
            Participants:
            Component watchers:
            Huong Nguyen, Bas Brands, Mathew May
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: