original_string: public function initialise_theme_and_output() {
          global $OUTPUT, $PAGE, $SITE, $CFG;
  
          if (!empty($this->_wherethemewasinitialised)) {
              return;
          }
  
          if (!during_initial_install()) {
              // Detect PAGE->context mess.
              $this->magic_get_context();
          }
  
          if (!$this->_course && !during_initial_install()) {
              $this->set_course($SITE);
          }
  
          if (is_null($this->_theme)) {
              $themename = $this->resolve_theme();
              $this->_theme = theme_config::load($themename);
          }
  
          $this->_theme->setup_blocks($this->pagelayout, $this->blocks);
  
          if ($this === $PAGE) {
              $target = null;
              if ($this->pagelayout === 'maintenance') {
                  // If the page is using the maintenance layout then we're going to force target to maintenance.
                  // This leads to a special core renderer that is designed to block access to API's that are likely unavailable for this
                  // page layout.
                  $target = RENDERER_TARGET_MAINTENANCE;
              }
              $OUTPUT = $this->get_renderer('core', null, $target);
          }
  
          if (!during_initial_install()) {
              $filtermanager = filter_manager::instance();
              $filtermanager->setup_page_for_globally_available_filters($this);
          }
  
          $this->_wherethemewasinitialised = debug_backtrace();
      }
code: public function initialise_theme_and_output() {
          global $OUTPUT, $PAGE, $SITE, $CFG;
  
          if (!empty($this->_wherethemewasinitialised)) {
              return;
          }
  
          if (!during_initial_install()) {
              // Detect PAGE->context mess.
              $this->magic_get_context();
          }
  
          if (!$this->_course && !during_initial_install()) {
              $this->set_course($SITE);
          }
  
          if (is_null($this->_theme)) {
              $themename = $this->resolve_theme();
              $this->_theme = theme_config::load($themename);
          }
  
          $this->_theme->setup_blocks($this->pagelayout, $this->blocks);
  
          if ($this === $PAGE) {
              $target = null;
              if ($this->pagelayout === 'maintenance') {
                  // If the page is using the maintenance layout then we're going to force target to maintenance.
                  // This leads to a special core renderer that is designed to block access to API's that are likely unavailable for this
                  // page layout.
                  $target = RENDERER_TARGET_MAINTENANCE;
              }
              $OUTPUT = $this->get_renderer('core', null, $target);
          }
  
          if (!during_initial_install()) {
              $filtermanager = filter_manager::instance();
              $filtermanager->setup_page_for_globally_available_filters($this);
          }
  
          $this->_wherethemewasinitialised = debug_backtrace();
      }
code_tokens: public function initialise_theme_and_output ( ) { global $ OUTPUT , $ PAGE , $ SITE , $ CFG ; if ( ! empty ( $ this -> _wherethemewasinitialised ) ) { return ; } if ( ! during_initial_install ( ) ) { // Detect PAGE->context mess. $ this -> magic_get_context ( ) ; } if ( ! $ this -> _course && ! during_initial_install ( ) ) { $ this -> set_course ( $ SITE ) ; } if ( is_null ( $ this -> _theme ) ) { $ themename = $ this -> resolve_theme ( ) ; $ this -> _theme = theme_config :: load ( $ themename ) ; } $ this -> _theme -> setup_blocks ( $ this -> pagelayout , $ this -> blocks ) ; if ( $ this === $ PAGE ) { $ target = null ; if ( $ this -> pagelayout === 'maintenance' ) { // If the page is using the maintenance layout then we're going to force target to maintenance. // This leads to a special core renderer that is designed to block access to API's that are likely unavailable for this // page layout. $ target = RENDERER_TARGET_MAINTENANCE ; } $ OUTPUT = $ this -> get_renderer ( 'core' , null , $ target ) ; } if ( ! during_initial_install ( ) ) { $ filtermanager = filter_manager :: instance ( ) ; $ filtermanager -> setup_page_for_globally_available_filters ( $ this ) ; } $ this -> _wherethemewasinitialised = debug_backtrace ( ) ; }
docstring: Method for use by Moodle core to set up the theme. Do not
  use this in your own code.
  
  Make sure the right theme for this page is loaded. Tell our
  blocks_manager about the theme block regions, and then, if
  we are $PAGE, set up the global $OUTPUT.
  
  @return void
docstring_tokens: Method for use by Moodle core to set up the theme . Do not use this in your own code .