/** * Prepare component configuration * * @return void */ public function prepare() { $size = abs((int) $this->getData('config/size')); $validation = [$this->getData('config/validation')]; while ($size--) { $identifier = $this->getName() . '_' . $size; $arguments = ['data' => ['name' => $identifier, 'config' => ['dataScope' => $size, 'dataType' => static::DATA_TYPE, 'formElement' => static::FORM_ELEMENT, 'sortOrder' => $size]]]; if (!empty($validation[$size])) { $arguments['data']['config']['validation'] = $validation[$size]; } $component = $this->uiComponentFactory->create($identifier, Field::NAME, $arguments); $component->prepare(); $this->components[$identifier] = $component; } parent::prepare(); }
/** * Prepare component configuration * * @return void */ public function prepare() { $config = $this->getData('config'); if (isset($this->options)) { if (!isset($config['options'])) { $config['options'] = []; } if ($this->options instanceof OptionSourceInterface) { $options = $this->options->toOptionArray(); } else { $options = array_values($this->options); } $config['options'] = array_values(array_merge_recursive($options, $config['options'])); } $this->setData('config', (array) $config); parent::prepare(); }
/** * Prepare component configuration * * @return void */ public function prepare() { parent::prepare(); $config = $this->getData('config'); if (isset($this->options)) { if (!isset($config['options'])) { $config['options'] = []; } if ($this->options instanceof OptionSourceInterface) { $options = $this->options->toOptionArray(); } else { $options = array_values($this->options); } $config['options'] = array_values(array_merge_recursive($options, $config['options'])); } $this->setData('config', (array) $config); $jsConfig = $this->getConfiguration($this, Input::NAME); $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig); }