Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactoring, moved the execute code into the initialize which in runn…

…ed by the parent construct
  • Loading branch information...
commit 99253839c3bfdca875c6240263dd942051d72493 1 parent a65d580
Henrik Bjørnskov authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 lib/view/sfTwigView.class.php
View
21 lib/view/sfTwigView.class.php
@@ -24,14 +24,17 @@ class sfTwigView extends sfPHPView
$extension = '.html';
/**
- * Sets up a Twig_Environment
+ * Initializes this view.
*
- * @return void
+ * @param sfContext $context The current application context
+ * @param string $moduleName The module name for this view
+ * @param string $actionName The action name for this view
+ * @param string $viewName The view name
+ * @return bool true, if initialization completes successfully, otherwise false
*/
- public function execute()
+ public function initialize($context, $moduleName, $actionName, $viewName)
{
- //Set up the decorator loader and set up the module loader
- $configuration = $this->context->getConfiguration();
+ parent::initialize($context, $moduleName, $actionName, $viewName);
//sets up a Twig_Loader_Array with directories
$this->twig_loaders['decorator'] = new Twig_Loader_FileSystem($this->getDecoratorDirectory(), sfConfig::get('sf_template_cache_dir'));
@@ -41,7 +44,6 @@ public function execute()
$this->twig = new Twig_Environment(null);
}
-
/**
* Renders the content
*
@@ -78,6 +80,13 @@ public function getEngine()
return $this->twig;
}
+ /**
+ * Renders a Twig_Template based on $loader_type
+ *
+ * @param string $loader_type this can be decorator or module
+ * @param string $content Content to be decorated if the $loader_type is decorator
+ * @returns string a rendered Twig_Template
+ */
protected function renderTemplate($loader_type, $content = null)
{
//Must be availible even tho Twig cant support calling them
Please sign in to comment.
Something went wrong with that request. Please try again.