public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $formName = $form->getName();
        //Make sure to exclude all form names starting with 2 underscores.
        //For instance the prototype of a Collection starts with 2 underscores
        if ('__' === substr($formName,0,2)) {
            return;
        }

        if (!empty($options['group'])) {
            $group = $options['group'];
            $type = 'group';
        } else {
            // If no group is set, make sure we have a unique index.
            // This is needed to maintain the correct order of the fields.
            $group = 'single_' . $formName;
            $type = 'single';
        }

        $root = $view->parent;

        if (!isset($root->vars['groups'][$group])) {
            $root->vars['groups'][$group] = [
                'type' => $type,
                'items' => [],
            ];
        }
        $root->vars['groups'][$group]['items'][] = $formName;
    }
public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $formName = $form->getName();
        //Make sure to exclude all form names starting with 2 underscores.
        //For instance the prototype of a Collection starts with 2 underscores
        if ('__' === substr($formName,0,2)) {
            return;
        }

        if (!empty($options['group'])) {
            $group = $options['group'];
            $type = 'group';
        } else {
            // If no group is set, make sure we have a unique index.
            // This is needed to maintain the correct order of the fields.
            $group = 'single_' . $formName;
            $type = 'single';
        }

        $root = $view->parent;

        if (!isset($root->vars['groups'][$group])) {
            $root->vars['groups'][$group] = [
                'type' => $type,
                'items' => [],
            ];
        }
        $root->vars['groups'][$group]['items'][] = $formName;
    }
public function buildView ( FormView $ view , FormInterface $ form , array $ options ) { $ formName = $ form -> getName ( ) ; //Make sure to exclude all form names starting with 2 underscores. //For instance the prototype of a Collection starts with 2 underscores if ( '__' === substr ( $ formName , 0 , 2 ) ) { return ; } if ( ! empty ( $ options [ 'group' ] ) ) { $ group = $ options [ 'group' ] ; $ type = 'group' ; } else { // If no group is set, make sure we have a unique index. // This is needed to maintain the correct order of the fields. $ group = 'single_' . $ formName ; $ type = 'single' ; } $ root = $ view -> parent ; if ( ! isset ( $ root -> vars [ 'groups' ] [ $ group ] ) ) { $ root -> vars [ 'groups' ] [ $ group ] = [ 'type' => $ type , 'items' => [ ] , ] ; } $ root -> vars [ 'groups' ] [ $ group ] [ 'items' ] [ ] = $ formName ; }
Preprocess view variables

@param \Symfony\Component\Form\FormView $view
@param \Symfony\Component\Form\FormInterface $form
@param array $options
Preprocess view variables