Open
Description
Description
I like the #[Template()] attribute when configuring controllers, and I'm excited to see the option to render just a block within the template.
I'd like to be able to define both the template and the block using the Symfony Expression Language. I'd like the request information passed, as that's often what I'm using to decide what template/block to render. For completeness, the security context would be nice too.
Example
(not sure what the 'context' is here)
#[Template(new Expression(
'"ROLE_ADMIN" in role_names or (is_authenticated() and user.isSuperAdmin())
or (context.request.query.get("admin_view")'
? 'admin/talk.html.twig'
: 'visitor/talk.html.twig',
))]
Ditto for the 'block' parameter. If the block parameter (new in 7.2!) accepted null (or false), then it should be treated as the same as if it weren't passed (so rendering the template normally).
Metadata
Metadata
Assignees
Labels
No labels