Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.77 KB

template-render.md

File metadata and controls

41 lines (32 loc) · 1.77 KB

Symfony Generics

Render template controller

===================================

Class: Addiks\SymfonyGenerics\Controllers\GenericTemplateRenderController

This generic controller allows to render a template and provide pre-configured arguments to that template.

Supported parameters:

Key Optional Description
template REQUIRED Path to the template file.
arguments OPTIONAL Configuration of arguments given to the template.
authorization-attribute OPTIONAL Name of the attribute used for authorization check.

To understand the authorization-attribute, see the symfony documentation on voters.

For a more detailed description of the argument configuration, see the documentation of the argument-compiler.

Full symfony service XML example:

    <service
        id="my_render_template_controller"
        class="Addiks\SymfonyGenerics\Controllers\GenericTemplateRenderController"
    >
        <argument type="service" id="symfony_generics.controller_helper" />
        <argument type="service" id="symfony_generics.argument_compiler" />
        <argument type="collection">
            <argument key="template">MyCoolBundle::some/path.html.twig</argument>
            <argument key="authorization-attribute">display-my-thing</argument>
            <argument key="arguments" type="collection">
                <argument key="myThing">$some_parameter_from_the_request</argument>
            </argument>
        </argument>
    </service>