當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UiComponentInterface::addComponent方法代碼示例

本文整理匯總了PHP中Magento\Framework\View\Element\UiComponentInterface::addComponent方法的典型用法代碼示例。如果您正苦於以下問題:PHP UiComponentInterface::addComponent方法的具體用法?PHP UiComponentInterface::addComponent怎麽用?PHP UiComponentInterface::addComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\View\Element\UiComponentInterface的用法示例。


在下文中一共展示了UiComponentInterface::addComponent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _toHtml

 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     foreach ($this->getChildNames() as $childName) {
         $childBlock = $this->getLayout()->getBlock($childName);
         if ($childBlock) {
             $wrapper = $this->blockWrapperFactory->create(['block' => $childBlock, 'data' => ['name' => 'block_' . $childName]]);
             $this->component->addComponent('block_' . $childName, $wrapper);
         }
     }
     $result = $this->component->render();
     return (string) $result;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:17,代碼來源:UiComponent.php

示例2: createChildFormComponent

 /**
  * Create child of form
  *
  * @param UiComponentInterface $childComponent
  * @param string $name
  * @return UiComponentInterface
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function createChildFormComponent(UiComponentInterface $childComponent, $name)
 {
     $panelComponent = $this->uiComponentFactory->create($name, $this->getConfig(self::CONFIG_PANEL_COMPONENT), ['context' => $this->component->getContext(), 'components' => [$childComponent->getName() => $childComponent]]);
     $panelComponent->prepare();
     $this->component->addComponent($name, $panelComponent);
     return $panelComponent;
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:15,代碼來源:Generic.php

示例3: prepare

 /**
  * 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->setData('config', array_replace_recursive((array) $this->wrappedComponent->getData('config'), (array) $this->getData('config')));
     foreach ($this->components as $nameComponent => $component) {
         $this->wrappedComponent->addComponent($nameComponent, $component);
     }
     $this->prepareChildComponent($this->wrappedComponent);
     $this->components = $this->wrappedComponent->getChildComponents();
     // 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', $this->wrappedComponent->getData('config'));
     parent::prepare();
 }
開發者ID:koliaGI,項目名稱:magento2,代碼行數:28,代碼來源:Field.php

示例4: update

 /**
  * {@inheritdoc}
  */
 public function update(UiComponentInterface $component)
 {
     if (!$component instanceof \Magento\Ui\Component\Filters) {
         return;
     }
     $attributeCodes = $component->getContext()->getRequestParam('attributes_codes');
     if ($attributeCodes) {
         foreach ($this->getAttributes($attributeCodes) as $attribute) {
             $filter = $this->filterFactory->create($attribute, $component->getContext());
             $filter->prepare();
             $component->addComponent($attribute->getAttributeCode(), $filter);
         }
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:17,代碼來源:Filters.php

示例5: prepareChildComponents

 /**
  * To prepare the structure of child components
  *
  * @param UiComponentInterface $component
  * @param string $parentName
  * @return array
  */
 protected function prepareChildComponents(UiComponentInterface $component, $parentName)
 {
     $name = $component->getName();
     $childComponents = $component->getChildComponents();
     $childrenStructure = [];
     foreach ($childComponents as $childName => $child) {
         $isVisible = $child->getData('config/visible');
         if ($isVisible !== null && $isVisible == 0) {
             continue;
         }
         /**
          * @var UiComponentInterface $childComponent
          * @var array $childStructure
          */
         list($childComponent, $childStructure) = $this->prepareChildComponents($child, $component->getName());
         $childrenStructure = array_merge($childrenStructure, $childStructure);
         $component->addComponent($childName, $childComponent);
     }
     $structure = [$name => ['type' => $component->getComponentName(), 'name' => $component->getName(), 'children' => $childrenStructure]];
     list($config, $dataScope) = $this->prepareConfig((array) $component->getConfiguration(), $name, $parentName);
     if ($dataScope !== false) {
         $structure[$name]['dataScope'] = $dataScope;
     }
     $structure[$name]['config'] = $config;
     return [$component, $structure];
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:33,代碼來源:Tabs.php


注:本文中的Magento\Framework\View\Element\UiComponentInterface::addComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。