Skip to content

Instantly share code, notes, and snippets.

@DracoBlue
Created May 4, 2012 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DracoBlue/2593535 to your computer and use it in GitHub Desktop.
Save DracoBlue/2593535 to your computer and use it in GitHub Desktop.
Index: libs/ApplicationBase/agavi/renderer/ApplicationPhpRenderer.class.php
===================================================================
--- libs/ApplicationBase/agavi/renderer/ApplicationPhpRenderer.class.php (revision 305)
+++ libs/ApplicationBase/agavi/renderer/ApplicationPhpRenderer.class.php (working copy)
@@ -94,6 +94,31 @@
public function render(AgaviTemplateLayer $layer, array &$attributes = array(), array &$slots = array(),
array &$more_assigns = array())
{
+ /*
+ * Dragons
+ */
+
+ $layer->appendParameter('targets', '${directory}/${template}.twig');
+ $stream_identifier = $layer->getResourceStreamIdentifier();
+
+ if (substr($stream_identifier, -5) === '.twig')
+ {
+ $twig_renderer = new AgaviTwigRenderer();
+ $parameters_for_twig_renderer = $this->getParameters();
+ $parameters_for_twig_renderer['extract_vars'] = true;
+ $parameters_for_twig_renderer['options'] = array(
+ 'autoescape' => true,
+ 'auto_reload' => true
+ );
+ $twig_renderer->initialize($this->context, $parameters_for_twig_renderer);
+ return $twig_renderer->render($layer, $attributes, $slots, $more_assigns);
+ }
+
+ /*
+ * /Dragons
+ */
+
$this->template_name = $layer->getParameter('template');
$allowed_variables = array(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment