ezsystems/ezpublish-kernel — pull request #264 by joekepley (2013-03-16 17:59:52+00:00)
Title: Add option to allow Twig template to override rendering of legacy requests

See https://jira.ez.no/browse/EZP-20576
See also http://share.ez.no/forums/ez-publish-5-platform/module-page-not-found-error

This is a small change that allow the Symfony/Twig stack to render the pagelayout for requests handled through the LegacyKernelController, reducing the workload required in developing a Twig-based site by remove the need for duplicating pagelayout development on both stacks.

The legacy ezpkernelweb is modified to pass back module_result as an attribute. The LegacyKernelController has been extended with an option to specify a legacy layout template in the same way that the default layout is specified in the parameters.yml. If specified, the module result information would be passed to this template for rendering rather than using the full output from the legacy stack.

An example parameters.yml would look like this:
```
parameters:
secret: mysecrethere
ezpublish_legacy.view.default_layout: BlendPartialContentBundle::pagelayout.html.twig
ezpublish_legacy.view.legacy_layout: BlendPartialContentBundle::legacylayout.html.twig
```

And a sample legacylayout.html.twig:

```
{% extends noLayout ? viewbaseLayout : "BlendPartialContentBundle::pagelayout.html.twig" %}
{% block pagetitle %}{% spaceless %}
{% for segment in module_result.path %}
{{ segment.text }}
{% if loop.last != true %} - {% endif %}
{% endfor %}
{% endspaceless %}{% endblock %}
{% block content %}
{{ module_result.content|raw }}
{% endblock %}
```

By utilizing pagelayout.html.twig, this means that pages like user/login and 'module not found' use the pagelayout provided by Twig instead of the eZTpl. Therefore, while work still needs to be done in the tpl to customize these pages, none of it is duplicate work from the Twig templates.