original_string: public function layout_file($pagelayout) {
          global $CFG;
  
          $layoutinfo = $this->layout_info_for_page($pagelayout);
          $layoutfile = $layoutinfo['file'];
  
          if (array_key_exists('theme', $layoutinfo)) {
              $themes = array($layoutinfo['theme']);
          } else {
              $themes = array_merge(array($this->name),$this->parents);
          }
  
          foreach ($themes as $theme) {
              if ($dir = $this->find_theme_location($theme)) {
                  $path = "$dir/layout/$layoutfile";
  
                  // Check the template exists, return general base theme template if not.
                  if (is_readable($path)) {
                      return $path;
                  }
              }
          }
  
          debugging('Can not find layout file for: ' . $pagelayout);
          // fallback to standard normal layout
          return "$CFG->dirroot/theme/base/layout/general.php";
      }
code: public function layout_file($pagelayout) {
          global $CFG;
  
          $layoutinfo = $this->layout_info_for_page($pagelayout);
          $layoutfile = $layoutinfo['file'];
  
          if (array_key_exists('theme', $layoutinfo)) {
              $themes = array($layoutinfo['theme']);
          } else {
              $themes = array_merge(array($this->name),$this->parents);
          }
  
          foreach ($themes as $theme) {
              if ($dir = $this->find_theme_location($theme)) {
                  $path = "$dir/layout/$layoutfile";
  
                  // Check the template exists, return general base theme template if not.
                  if (is_readable($path)) {
                      return $path;
                  }
              }
          }
  
          debugging('Can not find layout file for: ' . $pagelayout);
          // fallback to standard normal layout
          return "$CFG->dirroot/theme/base/layout/general.php";
      }
code_tokens: public function layout_file ( $ pagelayout ) { global $ CFG ; $ layoutinfo = $ this -> layout_info_for_page ( $ pagelayout ) ; $ layoutfile = $ layoutinfo [ 'file' ] ; if ( array_key_exists ( 'theme' , $ layoutinfo ) ) { $ themes = array ( $ layoutinfo [ 'theme' ] ) ; } else { $ themes = array_merge ( array ( $ this -> name ) , $ this -> parents ) ; } foreach ( $ themes as $ theme ) { if ( $ dir = $ this -> find_theme_location ( $ theme ) ) { $ path = "$dir/layout/$layoutfile" ; // Check the template exists, return general base theme template if not. if ( is_readable ( $ path ) ) { return $ path ; } } } debugging ( 'Can not find layout file for: ' . $ pagelayout ) ; // fallback to standard normal layout return "$CFG->dirroot/theme/base/layout/general.php" ; }
docstring: Given the settings of this theme, and the page pagelayout, return the
  full path of the page layout file to use.
  
  Used by {@link core_renderer::header()}.
  
  @param string $pagelayout the the page layout name.
  @return string Full path to the lyout file to use
docstring_tokens: Given the settings of this theme and the page pagelayout return the full path of the page layout file to use .