original_string: public function processSite($format = null, array $vars = [])
      {
          // set the page now its been processed
          $this->grav->fireEvent('onTwigSiteVariables');
          $pages = $this->grav['pages'];
          $page = $this->grav['page'];
          $content = $page->content();
  
          $twig_vars = $this->twig_vars;
  
          $twig_vars['theme'] = $this->grav['config']->get('theme');
          $twig_vars['pages'] = $pages->root();
          $twig_vars['page'] = $page;
          $twig_vars['header'] = $page->header();
          $twig_vars['media'] = $page->media();
          $twig_vars['content'] = $content;
          $ext = '.' . ($format ?: 'html') . TWIG_EXT;
  
          // determine if params are set, if so disable twig cache
          $params = $this->grav['uri']->params(null, true);
          if (!empty($params)) {
              $this->twig->setCache(false);
          }
  
          // Get Twig template layout
          $template = $this->template($page->template() . $ext);
  
          try {
              $output = $this->twig->render($template, $vars + $twig_vars);
          } catch (\Twig_Error_Loader $e) {
              $error_msg = $e->getMessage();
              // Try html version of this template if initial template was NOT html
              if ($ext !== '.html' . TWIG_EXT) {
                  try {
                      $page->templateFormat('html');
                      $output = $this->twig->render($page->template() . '.html' . TWIG_EXT, $vars + $twig_vars);
                  } catch (\Twig_Error_Loader $e) {
                      throw new \RuntimeException($error_msg, 400, $e);
                  }
              } else {
                  throw new \RuntimeException($error_msg, 400, $e);
              }
          }
  
          return $output;
      }
code: public function processSite($format = null, array $vars = [])
      {
          // set the page now its been processed
          $this->grav->fireEvent('onTwigSiteVariables');
          $pages = $this->grav['pages'];
          $page = $this->grav['page'];
          $content = $page->content();
  
          $twig_vars = $this->twig_vars;
  
          $twig_vars['theme'] = $this->grav['config']->get('theme');
          $twig_vars['pages'] = $pages->root();
          $twig_vars['page'] = $page;
          $twig_vars['header'] = $page->header();
          $twig_vars['media'] = $page->media();
          $twig_vars['content'] = $content;
          $ext = '.' . ($format ?: 'html') . TWIG_EXT;
  
          // determine if params are set, if so disable twig cache
          $params = $this->grav['uri']->params(null, true);
          if (!empty($params)) {
              $this->twig->setCache(false);
          }
  
          // Get Twig template layout
          $template = $this->template($page->template() . $ext);
  
          try {
              $output = $this->twig->render($template, $vars + $twig_vars);
          } catch (\Twig_Error_Loader $e) {
              $error_msg = $e->getMessage();
              // Try html version of this template if initial template was NOT html
              if ($ext !== '.html' . TWIG_EXT) {
                  try {
                      $page->templateFormat('html');
                      $output = $this->twig->render($page->template() . '.html' . TWIG_EXT, $vars + $twig_vars);
                  } catch (\Twig_Error_Loader $e) {
                      throw new \RuntimeException($error_msg, 400, $e);
                  }
              } else {
                  throw new \RuntimeException($error_msg, 400, $e);
              }
          }
  
          return $output;
      }
code_tokens: public function processSite ( $ format = null , array $ vars = [ ] ) { // set the page now its been processed $ this -> grav -> fireEvent ( 'onTwigSiteVariables' ) ; $ pages = $ this -> grav [ 'pages' ] ; $ page = $ this -> grav [ 'page' ] ; $ content = $ page -> content ( ) ; $ twig_vars = $ this -> twig_vars ; $ twig_vars [ 'theme' ] = $ this -> grav [ 'config' ] -> get ( 'theme' ) ; $ twig_vars [ 'pages' ] = $ pages -> root ( ) ; $ twig_vars [ 'page' ] = $ page ; $ twig_vars [ 'header' ] = $ page -> header ( ) ; $ twig_vars [ 'media' ] = $ page -> media ( ) ; $ twig_vars [ 'content' ] = $ content ; $ ext = '.' . ( $ format ? : 'html' ) . TWIG_EXT ; // determine if params are set, if so disable twig cache $ params = $ this -> grav [ 'uri' ] -> params ( null , true ) ; if ( ! empty ( $ params ) ) { $ this -> twig -> setCache ( false ) ; } // Get Twig template layout $ template = $ this -> template ( $ page -> template ( ) . $ ext ) ; try { $ output = $ this -> twig -> render ( $ template , $ vars + $ twig_vars ) ; } catch ( \ Twig_Error_Loader $ e ) { $ error_msg = $ e -> getMessage ( ) ; // Try html version of this template if initial template was NOT html if ( $ ext !== '.html' . TWIG_EXT ) { try { $ page -> templateFormat ( 'html' ) ; $ output = $ this -> twig -> render ( $ page -> template ( ) . '.html' . TWIG_EXT , $ vars + $ twig_vars ) ; } catch ( \ Twig_Error_Loader $ e ) { throw new \ RuntimeException ( $ error_msg , 400 , $ e ) ; } } else { throw new \ RuntimeException ( $ error_msg , 400 , $ e ) ; } } return $ output ; }
docstring: Twig process that renders the site layout. This is the main twig process that renders the overall
  page and handles all the layout for the site display.
  
  @param string $format Output format (defaults to HTML).
  
  @return string the rendered output
  @throws \RuntimeException
docstring_tokens: Twig process that renders the site layout . This is the main twig process that renders the overall page and handles all the layout for the site display .