EventListener/LayoutBoxSubscriber.php
public function onLayoutBoxFormInit(FormEvent $event)
    {
        $builder       = $event->getFormBuilder();
        $form          = $event->getForm();
        $configurators = $this->container->get('layout_box.configurator.collection')->all();
        $resource      = $event->getResource();
        $boxSettings   = $resource->getSettings();
        
        foreach ($configurators as $configurator) {
            if ($configurator instanceof LayoutBoxConfiguratorInterface) {
                $defaults = [];
                if ($resource->getBoxType() == $configurator->getType()) {
                    $defaults = $boxSettings;
                }
                
                $configurator->addFormFields($builder, $form, $defaults);
            }
        }
    }
public function onLayoutBoxFormInit(FormEvent $event)
    {
        $builder       = $event->getFormBuilder();
        $form          = $event->getForm();
        $configurators = $this->container->get('layout_box.configurator.collection')->all();
        $resource      = $event->getResource();
        $boxSettings   = $resource->getSettings();
        
        foreach ($configurators as $configurator) {
            if ($configurator instanceof LayoutBoxConfiguratorInterface) {
                $defaults = [];
                if ($resource->getBoxType() == $configurator->getType()) {
                    $defaults = $boxSettings;
                }
                
                $configurator->addFormFields($builder, $form, $defaults);
            }
        }
    }
public function onLayoutBoxFormInit ( FormEvent $ event ) { $ builder = $ event -> getFormBuilder ( ) ; $ form = $ event -> getForm ( ) ; $ configurators = $ this -> container -> get ( 'layout_box.configurator.collection' ) -> all ( ) ; $ resource = $ event -> getResource ( ) ; $ boxSettings = $ resource -> getSettings ( ) ; foreach ( $ configurators as $ configurator ) { if ( $ configurator instanceof LayoutBoxConfiguratorInterface ) { $ defaults = [ ] ; if ( $ resource -> getBoxType ( ) == $ configurator -> getType ( ) ) { $ defaults = $ boxSettings ; } $ configurator -> addFormFields ( $ builder , $ form , $ defaults ) ; } } }
Adds configurator fields to main layout box edit form.
Loops through all configurators, renders the fieldset and sets default data

@param FormEvent $event
Adds configurator fields to main layout box edit form . Loops through all configurators renders the fieldset and sets default data