Package

ViewHelpers

ViewHelper Documentation

render

A ViewHelper to render a section, a partial, a specified section in a partial or a delegate ParsedTemplateInterface implementation.

= Examples =

<f:render partial="SomePartial" arguments="{foo: someVariable}" /> the content of the partial "SomePartial". The content of the variable {someVariable} will be available in the partial as {foo}

<f:section name="someSection">This is a section. {foo}</f:section> <f:render section="someSection" arguments="{foo: someVariable}" /> the content of the section "someSection". The content of the variable {someVariable} will be available in the partial as {foo}

<f:section name="mySection">

</f:section> <f:render section="mySection" arguments="{myMenu: menu}" />
  • menu1

    <ul>
      <li>menu1a</li>
      <li>menu1b</li>
    </ul>
    

  • [...] (depending on the value of {menu})

    <f:render partial="somePartial" arguments="{_all}" /> the content of the partial "somePartial". Using the reserved keyword "_all", all available variables will be passed along to the partial

    <f:render delegate="My\Special\ParsedTemplateImplementation" arguments="{_all}" /> Whichever output was generated by calling My\Special\ParsedTemplateImplementation->render() with cloned RenderingContextInterface $renderingContext as only argument and content of arguments assigned in VariableProvider of cloned context. Supports all other input arguments including recursive rendering, contentAs argument, default value etc. Note that while ParsedTemplateInterface supports returning a Layout name, this Layout will not be respected when rendering using this method. Only the render() method will be called!

Arguments

section string, required

Section to render - combine with partial to render section in partial

partial string, required

Partial to render, with or without section

delegate string, required

Optional PHP class name of a permanent, included-in-app ParsedTemplateInterface implementation to override partial/section

arguments anySimpleType, required

Array of variables to be transferred. Use {_all} for all variables

optional boolean, required

If TRUE, considers the *section* optional. Partial never is.

default anySimpleType, required

Value (usually string) to be displayed if the section or partial does not exist

contentAs string, required

If used, renders the child content and adds it as a template variable with this name for use in the partial/section

ViewHelper Resources

Schema Resources