‪TYPO3CMS  ‪main
TYPO3\CMS\Form\Domain\Renderer\FluidFormRenderer Class Reference
Inheritance diagram for TYPO3\CMS\Form\Domain\Renderer\FluidFormRenderer:
TYPO3\CMS\Form\Domain\Renderer\AbstractElementRenderer TYPO3\CMS\Form\Domain\Renderer\RendererInterface

Public Member Functions

string render ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Form\Domain\Renderer\AbstractElementRenderer
 setFormRuntime (FormRuntime $formRuntime)
 
 getFormRuntime ()
 

Additional Inherited Members

- ‪Protected Attributes inherited from ‪TYPO3\CMS\Form\Domain\Renderer\AbstractElementRenderer
TYPO3 CMS Form Domain Runtime FormRuntime $formRuntime
 

Detailed Description

A fluid RendererInterface implementation used to render a FormDefinition.

This renderer is called from ().

Options

The FluidFormRenderer uses some rendering options which are of particular importance, as they determine how the form field is resolved to a path in the file system.

All rendering options are retrieved from the FormDefinition, using the () method.

templateRootPaths

Used to define several paths for templates, which will be tried in reversed order (the paths are searched from bottom to top). The first folder where the desired layout is found, is used. If the array keys are numeric, they are first sorted and then tried in reversed order. Within this paths, fluid will search for a file which is named like the renderable type. For example: templateRootPaths.10 = EXT:form/Resources/Private/Frontend/Templates/ $renderable->getType() = Form Expected template file: EXT:form/Resources/Private/Frontend/Templates/Form.html There is a setting available to set a custom template name. Please read the section 'templateName'.

Only the root renderable (FormDefinition) has to be a template file. All child renderables are partials. By default, the root renderable is called 'Form'.

layoutRootPaths

Used to define several paths for layouts, which will be tried in reversed order (the paths are searched from bottom to top). The first folder where the desired layout is found, is used. If the array keys are numeric, they are first sorted and then tried in reversed order.

partialRootPaths

Used to define several paths for partials, which will be tried in reversed order. The first folder where the desired partial is found, is used. The keys of the array define the order.

Within this paths, fluid will search for a file which is named like the renderable type. For example: templateRootPaths.10 = EXT:form/Resources/Private/Frontend/Partials/ $renderable->getType() = Text Expected template file: EXT:form/Resources/Private/Frontend/Partials/Text.html There is a setting available to set a custom partial name. Please read the section 'templateName'.

templateName

By default, the renderable type will be taken as the name for the template / partial. For example: partialRootPaths.10 = EXT:form/Resources/Private/Frontend/Partials/ $renderable->getType() = Text Expected partial file: EXT:form/Resources/Private/Frontend/Partials/Text.html

Set 'templateName' to define a custom name which should be used instead. For example: templateName = Foo $renderable->getType() = Text Expected partial file: EXT:form/Resources/Private/Frontend/Partials/Foo.html

Rendering Child Renderables

If a renderable wants to render child renderables, inside its template / partial, it can do that using the <formvh:renderRenderable> ViewHelper.

A template example from Page shall demonstrate this:

  <formvh:renderRenderable renderable="{page}">
      <f:for each="{page.elements}" as="element">
          <formvh:renderRenderable renderable="{element}">
              <f:render partial="{element.templateName}" arguments="{element: element}" />
          </formvh:renderRenderable>
      </f:for>
  </formvh:renderRenderable>

Scope: frontend This class is NOT meant to be sub classed by developers.

Definition at line 126 of file FluidFormRenderer.php.

Member Function Documentation

◆ render()

string TYPO3\CMS\Form\Domain\Renderer\FluidFormRenderer::render ( )

Renders the FormDefinition.

This method is expected to call the 'beforeRendering' hook on each renderable. This method call the 'beforeRendering' hook initially. Each other hooks will be called from the renderRenderable viewHelper. ()

Returns
‪string the rendered $formRuntime

Implements TYPO3\CMS\Form\Domain\Renderer\RendererInterface.

Definition at line 141 of file FluidFormRenderer.php.

References $GLOBALS, and TYPO3\CMS\Form\Domain\Renderer\AbstractElementRenderer\getFormRuntime().