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

Add extra plugin callbacks for every major stage of page render + swap user tours to use them

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Install the test admin tool plugin here:

      https://github.com/brendanheywood/moodle-tool_callbacktest

      Then load any random page and check that all 5 hooks have fired:

      1) the html element has the 'xmlns:og' attribute and 'escape' but not the badly overridden lang dir etc

      2) It has a http header of 'Foo: Bar'

      3) There is a meta tag in the head <meta name='foo' value='before_top_of_body_html' />

      4) there is a red chunk of text in the header

      5) a javascript popup fires and says 'before_footer'

      For the user tours:

      Check any page like the gradebook which doesn't contain the user nav but which should have the tour visible. (eg see MDL-57318)

      Show
      Install the test admin tool plugin here: https://github.com/brendanheywood/moodle-tool_callbacktest Then load any random page and check that all 5 hooks have fired: 1) the html element has the 'xmlns:og' attribute and 'escape' but not the badly overridden lang dir etc 2) It has a http header of 'Foo: Bar' 3) There is a meta tag in the head <meta name='foo' value='before_top_of_body_html' /> 4) there is a red chunk of text in the header 5) a javascript popup fires and says 'before_footer' For the user tours: Check any page like the gradebook which doesn't contain the user nav but which should have the tour visible. (eg see MDL-57318 )
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull Master Branch:
      MDL-53978-render-callbacks

      Description

      User tours (MDL-52777) should be fully implementable as a plugin with no core hacks required. In order for this to work - we should add callbacks to inject content in the page footer.

      The current code in the plugin has these core modifications:

      --- a/lib/outputrenderers.php
      +++ b/lib/outputrenderers.php
      @@ -783,6 +783,9 @@ class core_renderer extends renderer_base {
               }
       
               $loggedinas = '<div class="logininfo">'.$loggedinas.'</div>';
      +        if (class_exists('\\tool_usertours\\helper')) {
      +            \tool_usertours\helper::bootstrap_reset();
      +        }
       
               if (isset($SESSION->justloggedin)) {
                   unset($SESSION->justloggedin);
      @@ -1039,6 +1042,9 @@ class core_renderer extends renderer_base {
           public function footer() {
               global $CFG, $DB, $PAGE;
       
      +        if (class_exists('\\tool_usertours\\helper')) {
      +            \tool_usertours\helper::bootstrap();
      +        }
               $output = $this->container_end_all(true);
       
               $footer = $this->opencontainers->pop('header/footer');
      
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                10 Vote for this issue
                Watchers:
                20 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/17