Пример #1
0
 /**
  * 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();
 }
Пример #2
0
 /**
  * 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);
 }