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

Clean theme throws exception if set_pagelayout is called too late

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5.2
    • 2.5.2
    • Themes
    • MOODLE_25_STABLE
    • MOODLE_25_STABLE
    • MDL-42648_M26
    • Hide
      1. Comment out fix adding set_pagelayout() in line 36 in grade/edit/outcome/import.php
      2. Switch to Clean them
      3. Enable Outcomes (advanced features)
      4. Open course gradebook
      5. Select in dropdown 'Import outcomes'
      6. Make sure there are no errors on page but layout may look weird
      Show
      Comment out fix adding set_pagelayout() in line 36 in grade/edit/outcome/import.php Switch to Clean them Enable Outcomes (advanced features) Open course gradebook Select in dropdown 'Import outcomes' Make sure there are no errors on page but layout may look weird

      As found in MDL-40971 Clean theme throws an exception if $PAGE->set_pagelayout() is changed after output is initialised.

      Obviously in each particular case we should fix the call to set_pagelayout() like Mary did in MDL-40971.

      But in the generic case since we don't show any warnings (they are commented out) inside the set_pagelayout() function, theme should be more tolerant to it as well. Standard-like themes have some php code inside layout files checking if block regions are not empty:
      https://github.com/marinaglancy/moodle/blob/master/theme/base/layout/general.php#L6

      Bootstrapbase/clean should do something similar. AFAIK samhemelryk was trying to avoid php code in layout files, maybe we can insert the check in renderer then?

      diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php
      index 56b6f56..5a0bf27 100644
      --- a/lib/outputrenderers.php
      +++ b/lib/outputrenderers.php
      @@ -3199,7 +3199,12 @@ EOD;
                   'data-blockregion' => $displayregion,
                   'data-droptarget' => '1'
               );
      -        return html_writer::tag($tag, $this->blocks_for_region($region), $attributes);
      +        if ($this->page->blocks->region_has_content($region, $this)) {
      +            $content = $this->blocks_for_region($region);
      +        } else {
      +            $content = '';
      +        }
      +        return html_writer::tag($tag, $content, $attributes);
           }
       
           /**
      

            lazydaisy Mary Evans
            marina Marina Glancy
            Marina Glancy Marina Glancy
            Sam Hemelryk Sam Hemelryk
            Michael de Raadt Michael de Raadt
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.