Exemplo n.º 1
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     $config = (array) $this->getData('config');
     $config['content'] = $this->block->toHtml();
     $this->setData('config', $config);
     parent::prepare();
 }
Exemplo n.º 2
0
 /**
  * @inheritDoc
  */
 public function prepare()
 {
     if (!empty($this->actions)) {
         $this->setData('config', array_replace_recursive(['actions' => $this->actions], $this->getConfiguration()));
     }
     parent::prepare();
 }
Exemplo n.º 3
0
 /**
  * Register component
  *
  * @return void
  */
 public function prepare()
 {
     parent::prepare();
     $jsConfig = $this->getConfiguration($this);
     unset($jsConfig['extends']);
     $this->getContext()->addComponentDefinition($this->getContext()->getNamespace(), $jsConfig);
     $this->getContext()->addButtons($this->getData('buttons'), $this);
 }
Exemplo n.º 4
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     parent::prepare();
     $config = $this->getData('config');
     if (isset($config['update_url'])) {
         $config['update_url'] = $this->getContext()->getUrl($config['update_url']);
         $this->setData('config', $config);
     }
     $jsConfig = $this->getConfiguration($this);
     unset($jsConfig['extends']);
     $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
 }
Exemplo n.º 5
0
 /**
  * @return void
  */
 public function prepare()
 {
     $config = $this->getData('config');
     if (isset($config['options'])) {
         $options = [];
         foreach ($config['options'] as $option) {
             $option['url'] = $this->urlBuilder->getUrl($option['url']);
             $options[] = $option;
         }
         $config['options'] = $options;
         $this->setData('config', $config);
     }
     parent::prepare();
 }
Exemplo n.º 6
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     parent::prepare();
     $dataType = $this->getData('config/dataType');
     $wrappedComponentConfig = [];
     if ($dataType) {
         $this->wrappedComponent = $this->uiComponentFactory->create($this->getName(), $dataType, array_merge(['context' => $this->getContext()], (array) $this->getData()));
         $this->wrappedComponent->prepare();
         $wrappedComponentConfig = $this->getConfiguration($this->wrappedComponent);
     }
     $this->applySorting();
     $jsConfig = array_replace_recursive($wrappedComponentConfig, $this->getConfiguration($this));
     $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
 }
Exemplo n.º 7
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     foreach ($this->getChildComponents() as $column) {
         if ($column instanceof Column) {
             $meta = $this->getContext()->getDataProvider()->getFieldMetaInfo($this->getName(), $column->getName());
             if ($meta) {
                 $config = $column->getData('config');
                 $config = array_replace_recursive($config, $meta);
                 $column->setData('config', $config);
             }
         }
     }
     parent::prepare();
 }
Exemplo n.º 8
0
 /**
  * Prepare component configuration
  *
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function prepare()
 {
     parent::prepare();
     $formElement = $this->getData('config/formElement');
     if (null === $formElement) {
         throw new LocalizedException(__('The configuration parameter "formElement" is a required for "' . $this->getName() . '" field.'));
     }
     // Create of wrapped component
     $this->wrappedComponent = $this->uiComponentFactory->create($this->getName(), $formElement, array_merge(['context' => $this->getContext()], (array) $this->getData()));
     $this->wrappedComponent->prepare();
     // To prepare the component configuration
     $wrappedComponentConfig = $this->getConfiguration($this->wrappedComponent);
     $jsConfig = array_replace_recursive($wrappedComponentConfig, $this->getConfiguration($this, $this->wrappedComponent->getComponentName()));
     $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
 }
Exemplo n.º 9
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     $dataType = $this->getData('config/dataType');
     if ($dataType) {
         $this->wrappedComponent = $this->uiComponentFactory->create($this->getName(), $dataType, array_merge(['context' => $this->getContext()], (array) $this->getData()));
         $this->wrappedComponent->prepare();
         $wrappedComponentConfig = $this->getJsConfig($this->wrappedComponent);
         // Merge JS configuration with wrapped component configuration
         $jsConfig = array_replace_recursive($wrappedComponentConfig, $this->getJsConfig($this));
         $this->setData('js_config', $jsConfig);
         $this->setData('config', array_replace_recursive((array) $this->wrappedComponent->getData('config'), (array) $this->getData('config')));
     }
     $this->applySorting();
     parent::prepare();
 }
Exemplo n.º 10
0
 /**
  * Register component
  *
  * @return void
  */
 public function prepare()
 {
     $config = $this->getData('config');
     if (isset($config['actions'])) {
         $config['actions'] = array_values($config['actions']);
         array_walk_recursive($config['actions'], function (&$item, $key, $context) {
             /** @var ContextInterface $context */
             if ($key === 'url') {
                 $item = $context->getUrl($item);
             }
         }, $this->getContext());
         $this->setData('config', $config);
     }
     parent::prepare();
 }
Exemplo n.º 11
0
 /**
  * Prepare component configuration
  *
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function prepare()
 {
     $formElement = $this->getData('config/formElement');
     if (null === $formElement) {
         throw new LocalizedException(__('The configuration parameter "formElement" is a required for "' . $this->getName() . '" field.'));
     }
     // Create of wrapped component
     $this->wrappedComponent = $this->uiComponentFactory->create($this->getName(), $formElement, array_merge(['context' => $this->getContext()], (array) $this->getData()));
     $this->wrappedComponent->prepare();
     // Merge JS configuration with wrapped component configuration
     $wrappedComponentConfig = $this->getJsConfig($this->wrappedComponent);
     $jsConfig = array_replace_recursive($wrappedComponentConfig, $this->getJsConfig($this));
     $jsConfig['extends'] = $this->wrappedComponent->getComponentName();
     $this->setData('js_config', $jsConfig);
     $this->setData('config', array_replace_recursive((array) $this->wrappedComponent->getData('config'), (array) $this->getData('config')));
     parent::prepare();
 }
Exemplo n.º 12
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     foreach ($this->getChildComponents() as $name => $child) {
         if ($child instanceof Container) {
             $this->fieldsInContainers += $child->getChildComponents();
         }
     }
     $fieldsMeta = $this->getContext()->getDataProvider()->getFieldsMetaInfo($this->getName());
     foreach ($fieldsMeta as $name => $fieldData) {
         if (empty($fieldData)) {
             continue;
         }
         $fieldComponent = $this->getComponent($name);
         $this->prepareField($fieldData, $name, $fieldComponent);
     }
     parent::prepare();
 }
Exemplo n.º 13
0
 /**
  * Register component
  *
  * @return void
  */
 public function prepare()
 {
     $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
     $config = [];
     if (!empty($namespace)) {
         $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
         /** @var \Magento\Ui\Api\Data\BookmarkInterface $bookmark */
         foreach ($bookmarks->getItems() as $bookmark) {
             if ($bookmark->isCurrent()) {
                 $config['activeIndex'] = $bookmark->getIdentifier();
             }
             $config = array_merge_recursive($config, $bookmark->getConfig());
         }
     }
     $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));
     parent::prepare();
     $jsConfig = $this->getConfiguration($this);
     $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
 }
Exemplo n.º 14
0
 /**
  * {@inheritdoc}
  */
 public function prepare()
 {
     $this->filterModifier->applyFilterModifier($this->getContext()->getDataProvider(), $this->getName());
     parent::prepare();
 }
Exemplo n.º 15
0
 /**
  * Register component and build layout structure
  *
  * @inheritdoc
  */
 public function prepare()
 {
     $this->layoutTypeObject = $this->layoutPool->create($this->type);
     $this->structure = $this->layoutTypeObject->build($this);
     parent::prepare();
 }
 /**
  * @return void
  */
 public function prepare()
 {
     $config = $this->getData('config');
     if (isset($config['options'])) {
         $options = [];
         foreach ($config['options'] as $option) {
             $option['url'] = $this->urlBuilder->getUrl($option['url']);
             $options[] = $option;
         }
         $config['options'] = $options;
     }
     $store = $this->storeManager->getStore();
     $config['validationEnabled'] = $this->config->isAddressValidationEnabled($store);
     $hasChoice = $this->config->allowUserToChooseAddress($store);
     if ($hasChoice) {
         $instructions = $this->config->getAddressValidationInstructionsWithChoice($store);
     } else {
         $instructions = $this->config->getAddressValidationInstructionsWithOutChoice($store);
     }
     $config['instructions'] = $instructions;
     $config['errorInstructions'] = $this->config->getAddressValidationErrorInstructions($store);
     $config['countriesEnabled'] = $this->config->getAddressValidationCountriesEnabled($store);
     $config['baseUrl'] = $this->urlBuilder->getUrl(self::VALIDATE_ADDRESS_PATH);
     $this->setData('config', $config);
     parent::prepare();
 }
Exemplo n.º 17
0
 /**
  * Prepare component configuration
  *
  * @return void
  */
 public function prepare()
 {
     parent::prepare();
     $jsConfig = $this->getConfiguration($this);
     $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
 }