public function __construct($name, $title) { $this->title = $title; $this->name = $name; parent::__construct(); }
/** * Helper function to create a generic ConfigLayout entity. * * @param Container $container * @param Template $template * @param TemplateConfig\Layout $parent * @return TemplateConfig\Layout */ private function createContainer(Container $container, Template $template, TemplateConfig\Layout $parent = null) { $entity = $this->checkExistingLayout($template->getLayouts(), $container->getName()); $entity->setTemplate($template); $entity->setParent($parent); $entity->setName($container->getName()); $entity->setAttributes($container->getAttributes()); return $entity; }
/** * @param Tab $element * @return $this */ public function addTab(Tab $element) { return parent::addElement($element); }
/** * 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; }