• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Element\UiComponentInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\View\Element\UiComponentInterface的典型用法代码示例。如果您正苦于以下问题:PHP UiComponentInterface类的具体用法?PHP UiComponentInterface怎么用?PHP UiComponentInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UiComponentInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: prepareComponent

 /**
  * Call prepare method in the component UI
  *
  * @param UiComponentInterface $component
  * @return void
  */
 protected function prepareComponent(UiComponentInterface $component)
 {
     foreach ($component->getChildComponents() as $child) {
         $this->prepareComponent($child);
     }
     $component->prepare();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Render.php


示例2: addChildren

 /**
  * Add children data
  *
  * @param array $topNode
  * @param UiComponentInterface $component
  * @param string $componentType
  * @return void
  */
 protected function addChildren(array &$topNode, UiComponentInterface $component, $componentType)
 {
     $childrenNode = [];
     $childComponents = $component->getChildComponents();
     if (!empty($childComponents)) {
         /** @var UiComponentInterface $child */
         foreach ($childComponents as $child) {
             if ($child instanceof DataSourceInterface) {
                 continue;
             }
             self::addChildren($childrenNode, $child, $child->getComponentName());
         }
     }
     /** @var JsConfigInterface $component */
     $config = $component->getJsConfig();
     if (is_string($config)) {
         $topNode[] = $config;
     } else {
         $nodeData = ['type' => $componentType, 'name' => $component->getName()];
         if (!empty($childrenNode)) {
             $nodeData['children'] = $childrenNode;
         }
         if (isset($config['dataScope'])) {
             $nodeData['dataScope'] = $config['dataScope'];
             unset($config['dataScope']);
         }
         if (!empty($config)) {
             $nodeData['config'] = $config;
         }
         $topNode[] = $nodeData;
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:40,代码来源:Generic.php


示例3: generate

 /**
  * Build component structure and retrieve
  *
  * @param UiComponentInterface $component
  * @return array
  */
 public function generate(UiComponentInterface $component)
 {
     /** @var LayoutInterface $layout */
     if (!($layoutDefinition = $component->getData('layout'))) {
         $layoutDefinition = ['type' => 'generic'];
     }
     $layout = $this->layoutPool->create($layoutDefinition['type'], $layoutDefinition);
     return $layout->build($component);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:Structure.php


示例4: getColumns

 /**
  * Returns columns list
  *
  * @param UiComponentInterface $component
  * @return UiComponentInterface[]
  */
 protected function getColumns(UiComponentInterface $component)
 {
     if (!isset($this->columns[$component->getName()])) {
         $columns = $this->getColumnsComponent($component);
         foreach ($columns->getChildComponents() as $column) {
             $this->columns[$component->getName()][$column->getName()] = $column;
         }
     }
     return $this->columns[$component->getName()];
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:MetadataProvider.php


示例5: prepareComponent

 /**
  * Call prepare method in the component UI
  *
  * @param UiComponentInterface $component
  * @return void
  */
 protected function prepareComponent(UiComponentInterface $component)
 {
     $childComponents = $component->getChildComponents();
     if (!empty($childComponents)) {
         foreach ($childComponents as $child) {
             $this->prepareComponent($child);
         }
     }
     $component->prepare();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:16,代码来源:Render.php


示例6: getColumns

 /**
  * Returns columns list
  *
  * @param UiComponentInterface $component
  * @return UiComponentInterface[]
  */
 protected function getColumns(UiComponentInterface $component)
 {
     if (!isset($this->columns[$component->getName()])) {
         $columns = $this->getColumnsComponent($component);
         foreach ($columns->getChildComponents() as $column) {
             if ($column->getData('config/label') && $column->getData('config/dataType') !== 'actions') {
                 $this->columns[$component->getName()][$column->getName()] = $column;
             }
         }
     }
     return $this->columns[$component->getName()];
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:18,代码来源:MetadataProvider.php


示例7: testAttachAndNotify

 public function testAttachAndNotify()
 {
     $type = 'test_type';
     $this->component->expects($this->any())->method('getComponentName')->willReturn($type);
     $this->observer->expects($this->any())->method('update')->with($this->component);
     /** @var UiComponentInterface $component2 */
     $component2 = $this->getMockBuilder('Magento\\Framework\\View\\Element\\UiComponentInterface')->getMockForAbstractClass();
     $component2->expects($this->any())->method('getComponentName')->willReturn('other_type');
     $this->processor->register($this->component);
     $this->processor->register($component2);
     $this->processor->attach($type, $this->observer);
     $this->processor->notify($type);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:ProcessorTest.php


示例8: render

 /**
  * Render data
  *
  * @param UiComponentInterface $component
  * @param string $template
  * @return string
  * @throws \Exception
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function render(UiComponentInterface $component, $template = '')
 {
     $context = $component->getContext();
     $isComponent = $context->getRequestParam('componentJson');
     if ($isComponent) {
         $data = $this->structure->generate($component);
         return $this->encoder->encode($data);
     } else {
         $data = $component->getContext()->getDataSourceData($component);
         $data = reset($data);
         return $this->encoder->encode($data['config']['data']);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:22,代码来源:Json.php


示例9: compile

 /**
  * Compiles the Element node
  *
  * @param Compiler $compiler
  * @param \DOMElement $node
  * @param UiComponentInterface $component
  * @param Object $context
  * @return void
  */
 public function compile(Compiler $compiler, \DOMElement $node, UiComponentInterface $component, Object $context)
 {
     $name = $node->getAttribute('name');
     $content = (string) $component->renderChildComponent($name);
     $name .= '_' . sprintf('%x', crc32(spl_object_hash($context)));
     if (!empty($content)) {
         $compiler->setPostprocessingData($name, $content);
         $newNode = $node->ownerDocument->createTextNode(Compiler::PATTERN_TAG . $name . Compiler::PATTERN_TAG);
         $node->parentNode->replaceChild($newNode, $node);
     } else {
         $node->parentNode->removeChild($node);
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:22,代码来源:Content.php


示例10: 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


示例11: compile

 /**
  * Compiles the Element node
  *
  * @param Compiler $compiler
  * @param \DOMElement $node
  * @param UiComponentInterface $component
  * @param Object $context
  * @return void
  */
 public function compile(Compiler $compiler, \DOMElement $node, UiComponentInterface $component, Object $context)
 {
     $result = $component->renderChildComponent($node->getAttribute('name'));
     if ($result instanceof Result) {
         $node->parentNode->replaceChild($result->getDocumentElement(), $node);
     } else {
         if (!empty($result) && is_scalar($result)) {
             $newFragment = $node->ownerDocument->createDocumentFragment();
             $newFragment->appendXML($result);
             $node->parentNode->replaceChild($newFragment, $node);
             $node->parentNode->removeChild($node);
         } else {
             $node->parentNode->removeChild($node);
         }
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:25,代码来源:Render.php


示例12: getDataXml

 /**
  * @param UiComponentInterface $view
  * @return string
  */
 protected function getDataXml(UiComponentInterface $view)
 {
     $result = ['configuration' => $view->getRenderContext()->getStorage()->getComponentsData($view->getName())->getData(), 'data' => []];
     foreach ($view->getRenderContext()->getStorage()->getData($view->getName()) as $key => $value) {
         if (is_object($value)) {
             if (method_exists($value, 'toXml')) {
                 $result['data'][$key] = $value->toXml();
             } else {
                 $result['data'][$key] = $this->objectToXml($value);
             }
         } else {
             $result['data'][$key] = $value;
         }
     }
     return $this->generator->arrayToXml($result);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:20,代码来源:Xml.php


示例13: update

 /**
  * @inheritDoc
  */
 public function update(UiComponentInterface $component)
 {
     if ($component instanceof ColumnInterface) {
         $filterType = $component->getData('config/filter');
         if (is_array($filterType)) {
             $filterType = $filterType['filterType'];
         }
         if (!$filterType) {
             return;
         }
         if (isset($this->filterMap[$filterType])) {
             $filterComponent = $this->uiComponentFactory->create($component->getName(), $this->filterMap[$filterType], ['context' => $this->getContext()]);
             $filterComponent->setData('config', $component->getConfiguration());
             $filterComponent->prepare();
             $this->addComponent($component->getName(), $filterComponent);
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:Filters.php


示例14: applyEditing

 /**
  * Add editor config
  *
  * @param UiComponentInterface $column
  * @param string $frontendInput
  * @param array $validationRules
  * @param bool|false $isRequired
  * @return UiComponentInterface
  */
 public function applyEditing(UiComponentInterface $column, $frontendInput, array $validationRules, $isRequired = false)
 {
     if (in_array($frontendInput, $this->editableFields)) {
         $config = $column->getConfiguration();
         $editorType = $config['dataType'];
         if (isset($config['editor']) && is_string($config['editor'])) {
             $editorType = $config['editor'];
         }
         if (!(isset($config['editor']) && isset($config['editor']['editorType']))) {
             $config['editor'] = ['editorType' => $editorType];
         }
         $validationRules = $this->validationRules->getValidationRules($isRequired, $validationRules);
         if (!empty($config['editor']['validation'])) {
             $validationRules = array_merge($config['editor']['validation'], $validationRules);
         }
         $config['editor']['validation'] = $validationRules;
         $column->setData('config', $config);
     }
     return $column;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:29,代码来源:InlineEditUpdater.php


示例15: updateComponent

 /**
  * Update component data
  *
  * @param array $componentData
  * @param UiComponentInterface $component
  * @return $this
  */
 protected function updateComponent(array $componentData, UiComponentInterface $component)
 {
     $config = $component->getData('config');
     // XML data configuration override configuration coming from the DB
     $config = array_replace_recursive($componentData, $config);
     $component->setData('config', $config);
     return $this;
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:15,代码来源:AbstractComponent.php


示例16: createContainer

 /**
  * Create button container
  *
  * @param string $key
  * @param UiComponentInterface $view
  * @return Container
  */
 protected function createContainer($key, UiComponentInterface $view)
 {
     $container = $this->context->getPageLayout()->createBlock('Magento\\Ui\\Component\\Control\\Container', 'container-' . $view->getName() . '-' . $key, ['data' => ['button_item' => $this->items[$key], 'context' => $view]]);
     return $container;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:ActionPool.php


示例17: 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


示例18: addOptions

 /**
  * Add options to component
  *
  * @param UiComponentInterface $component
  * @param array $attributeData
  * @return void
  */
 public function addOptions(UiComponentInterface $component, array $attributeData)
 {
     $config = $component->getData('config');
     if (count($attributeData[AttributeMetadata::OPTIONS]) && !isset($config[AttributeMetadata::OPTIONS])) {
         $component->setData('config', array_merge($config, [AttributeMetadata::OPTIONS => $attributeData[AttributeMetadata::OPTIONS]]));
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Columns.php


示例19: getConfiguration

 /**
  * Get JS configuration
  *
  * @param UiComponentInterface $component
  * @param null|string $extends
  * @return array
  */
 protected function getConfiguration(UiComponentInterface $component, $extends = null)
 {
     $jsConfig = (array) $component->getData('js_config');
     if (isset($jsConfig['extends'])) {
         return $jsConfig;
     } else {
         if (null !== $extends) {
             $jsConfig['extends'] = $extends;
         } else {
             $jsConfig['extends'] = $component->getContext()->getNamespace();
         }
     }
     return $jsConfig;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:21,代码来源:AbstractComponent.php


示例20: updateField

 /**
  * Update field data
  *
  * @param array $fieldData
  * @param UiComponentInterface $component
  * @return void
  */
 protected function updateField(array $fieldData, UiComponentInterface $component)
 {
     $config = $component->getData('config');
     // XML data configuration override configuration coming from the DB
     $config = array_replace_recursive($fieldData, $config);
     $config = $this->updateDataScope($config, $component->getName());
     $component->setData('config', $config);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:Fieldset.php



注:本文中的Magento\Framework\View\Element\UiComponentInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Template\Context类代码示例发布时间:2022-05-23
下一篇:
PHP Element\Template类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap