original_string: public function index_onOpenTemplate()
      {
          $this->validateRequestTheme();
  
          $type = Request::input('type');
          $template = $this->loadTemplate($type, Request::input('path'));
          $widget = $this->makeTemplateFormWidget($type, $template);
  
          $this->vars['templatePath'] = Request::input('path');
          $this->vars['lastModified'] = DateTime::makeCarbon($template->mtime);
  
          if ($type === 'page') {
              $router = new RainRouter;
              $this->vars['pageUrl'] = $router->urlFromPattern($template->url);
          }
  
          return [
              'tabTitle' => $this->getTabTitle($type, $template),
              'tab'      => $this->makePartial('form_page', [
                  'form'          => $widget,
                  'templateType'  => $type,
                  'templateTheme' => $this->theme->getDirName(),
                  'templateMtime' => $template->mtime
              ])
          ];
      }
code: public function index_onOpenTemplate()
      {
          $this->validateRequestTheme();
  
          $type = Request::input('type');
          $template = $this->loadTemplate($type, Request::input('path'));
          $widget = $this->makeTemplateFormWidget($type, $template);
  
          $this->vars['templatePath'] = Request::input('path');
          $this->vars['lastModified'] = DateTime::makeCarbon($template->mtime);
  
          if ($type === 'page') {
              $router = new RainRouter;
              $this->vars['pageUrl'] = $router->urlFromPattern($template->url);
          }
  
          return [
              'tabTitle' => $this->getTabTitle($type, $template),
              'tab'      => $this->makePartial('form_page', [
                  'form'          => $widget,
                  'templateType'  => $type,
                  'templateTheme' => $this->theme->getDirName(),
                  'templateMtime' => $template->mtime
              ])
          ];
      }
code_tokens: public function index_onOpenTemplate ( ) { $ this -> validateRequestTheme ( ) ; $ type = Request :: input ( 'type' ) ; $ template = $ this -> loadTemplate ( $ type , Request :: input ( 'path' ) ) ; $ widget = $ this -> makeTemplateFormWidget ( $ type , $ template ) ; $ this -> vars [ 'templatePath' ] = Request :: input ( 'path' ) ; $ this -> vars [ 'lastModified' ] = DateTime :: makeCarbon ( $ template -> mtime ) ; if ( $ type === 'page' ) { $ router = new RainRouter ; $ this -> vars [ 'pageUrl' ] = $ router -> urlFromPattern ( $ template -> url ) ; } return [ 'tabTitle' => $ this -> getTabTitle ( $ type , $ template ) , 'tab' => $ this -> makePartial ( 'form_page' , [ 'form' => $ widget , 'templateType' => $ type , 'templateTheme' => $ this -> theme -> getDirName ( ) , 'templateMtime' => $ template -> mtime ] ) ] ; }
docstring: Opens an existing template from the index page
  @return array
docstring_tokens: Opens an existing template from the index page