original_string: 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);
              }
          }
      }
code: 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);
              }
          }
      }
code_tokens: 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 ) ; } } }
docstring: Adds configurator fields to main layout box edit form.
  Loops through all configurators, renders the fieldset and sets default data
  
  @param FormEvent $event
docstring_tokens: Adds configurator fields to main layout box edit form . Loops through all configurators renders the fieldset and sets default data