コード例 #1
0
ファイル: Configurator.php プロジェクト: GerDner/luck-docker
 /**
  * Helper function to create an array with all container and element names.
  * This function is used to synchronize the configuration fields and containers.
  * Elements which not stored in this array has to be removed by the removeUnused()
  * function
  *
  * @param \Shopware\Components\Form\Container $container
  * @return array
  */
 private function getContainerNames(Form\Container $container)
 {
     $layout = array('containers' => array(), 'fields' => array());
     $layout['containers'][] = $container->getName();
     foreach ($container->getElements() as $element) {
         if ($element instanceof Form\Container) {
             $child = $this->getContainerNames($element);
             $layout['containers'] = array_merge($layout['containers'], $child['containers']);
             $layout['fields'] = array_merge($layout['fields'], $child['fields']);
         } elseif ($element instanceof Form\Field) {
             $layout['fields'][] = $element->getName();
         }
     }
     return $layout;
 }