PHP Class Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper

Author: Fabien Potencier ([email protected])
Author: Bernhard Schussek ([email protected])
Inheritance: extends Symfony\Component\Templating\Helper\Helper
ファイルを表示 Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$context
$engine
$resources
$templates
$themes
$varStack

Public Methods

Method Description
__construct ( Symfony\Component\Templating\EngineInterface $engine, array $resources ) Constructor;
enctype ( Symfony\Component\Form\FormView $view ) : string Renders the HTML enctype in the form tag, if necessary.
errors ( Symfony\Component\Form\FormView $view ) : string Renders the errors of the given view.
getName ( )
isChoiceGroup ( $label )
isChoiceSelected ( Symfony\Component\Form\FormView $view, $choice )
label ( Symfony\Component\Form\FormView $view, string $label = null, array $variables = [] ) : string Renders the label of the given view.
renderBlock ( string $name, array $variables = [] ) Render a block from a form element.
rest ( Symfony\Component\Form\FormView $view, array $variables = [] ) : string Renders views which have not already been rendered.
row ( Symfony\Component\Form\FormView $view, array $variables = [] ) : string Renders the entire form field "row".
setTheme ( Symfony\Component\Form\FormView $view, $themes ) Sets a theme for a given view.
widget ( Symfony\Component\Form\FormView $view, array $variables = [] ) : string Renders the HTML for a given view.

Protected Methods

Method Description
lookupTemplate ( Symfony\Component\Form\FormView $view, string $block ) : string | boolean Returns the name of the template to use to render the block
renderSection ( Symfony\Component\Form\FormView $view, string $section, array $variables = [] ) : string Renders a template.

Method Details

__construct() public method

Constructor;
public __construct ( Symfony\Component\Templating\EngineInterface $engine, array $resources )
$engine Symfony\Component\Templating\EngineInterface The templating engine
$resources array An array of theme name

enctype() public method

Example usage templates:
enctype() ?>>
public enctype ( Symfony\Component\Form\FormView $view ) : string
$view Symfony\Component\Form\FormView The view for which to render the encoding type
return string The html markup

errors() public method

Renders the errors of the given view.
public errors ( Symfony\Component\Form\FormView $view ) : string
$view Symfony\Component\Form\FormView The view to render the errors for
return string The html markup

getName() public method

public getName ( )

isChoiceGroup() public method

public isChoiceGroup ( $label )

isChoiceSelected() public method

public isChoiceSelected ( Symfony\Component\Form\FormView $view, $choice )
$view Symfony\Component\Form\FormView

label() public method

Renders the label of the given view.
public label ( Symfony\Component\Form\FormView $view, string $label = null, array $variables = [] ) : string
$view Symfony\Component\Form\FormView The view for which to render the label
$label string The label
$variables array Additional variables passed to the template
return string The html markup

lookupTemplate() protected method

Returns the name of the template to use to render the block
protected lookupTemplate ( Symfony\Component\Form\FormView $view, string $block ) : string | boolean
$view Symfony\Component\Form\FormView The form view
$block string The name of the block
return string | boolean The template logical name or false when no template is found

renderBlock() public method

Render a block from a form element.
public renderBlock ( string $name, array $variables = [] )
$name string
$variables array Additional variables (those would override the current context)

renderSection() protected method

1. This function first looks for a block named "__
", 2. if such a block is not found the function will look for a block named "_
", 3. the type name is recursively replaced by the parent type name until a corresponding block is found
protected renderSection ( Symfony\Component\Form\FormView $view, string $section, array $variables = [] ) : string
$view Symfony\Component\Form\FormView The form view
$section string The section to render (i.e. 'row', 'widget', 'label', ...)
$variables array Additional variables
return string The html markup

rest() public method

Renders views which have not already been rendered.
public rest ( Symfony\Component\Form\FormView $view, array $variables = [] ) : string
$view Symfony\Component\Form\FormView The parent view
$variables array An array of variables
return string The html markup

row() public method

Renders the entire form field "row".
public row ( Symfony\Component\Form\FormView $view, array $variables = [] ) : string
$view Symfony\Component\Form\FormView The view for which to render the row
$variables array Additional variables passed to the template
return string The html markup

setTheme() public method

The theme format is ":".
public setTheme ( Symfony\Component\Form\FormView $view, $themes )
$view Symfony\Component\Form\FormView A FormView instance

widget() public method

Example usage: widget() ?> You can pass options during the call: widget(array('attr' => array('class' => 'foo'))) ?> widget(array('separator' => '+++++)) ?>
public widget ( Symfony\Component\Form\FormView $view, array $variables = [] ) : string
$view Symfony\Component\Form\FormView The view for which to render the widget
$variables array Additional variables passed to the template
return string The html markup

Property Details

$context protected_oe property

protected $context

$engine protected_oe property

protected $engine

$resources protected_oe property

protected $resources

$templates protected_oe property

protected $templates

$themes protected_oe property

protected $themes

$varStack protected_oe property

protected $varStack