Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper::row PHP Method

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
    public function row(FormView $view, array $variables = array())
    {
        return $this->renderSection($view, 'row', $variables);
    }

Usage Example

Esempio n. 1
0
    /**
     * @param FormView $form
     * @param FormHelper $formHelper
     */
    public function all_conditions($form, $formHelper)
    {
        ?>
        <?php 
        $allConditions = [];
        ?>
        <?php 
        foreach ($form['conditions']->children as $child) {
            $conditionHtml = $formHelper->row($child);
            $conditionHtml = str_replace(['form___ALL_CONDITIONS__', 'form[__ALL_CONDITIONS__]'], ['{{ id }}', '{{ name }}'], $conditionHtml);
            $allConditions[] = $child['name']->vars['value'];
            ?>
            <script type="text/x-handlebars" charset="UTF-8" id="tplCondition_<?php 
            echo $child['name']->vars['value'];
            ?>
"
                    class="js-template js-condition-template" data-condition="<?php 
            echo $child['name']->vars['value'];
            ?>
">
                <?php 
            echo $conditionHtml . "\n";
            ?>
            </script>
        <?php 
        }
        ?>
        <script type="text/javascript">
            VulnInfo = typeof VulnInfo == 'object' ? VulnInfo : {};
            VulnInfo.conditions = ['<?php 
        echo implode("', '", $allConditions);
        ?>
'];
        </script>
        <?php 
        echo $formHelper->rest($form);
        ?>
        <?php 
    }