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


PHP Element\UiComponentInterface類代碼示例

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


在下文中一共展示了UiComponentInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getJsConfig

 /**
  * Get JS config
  *
  * @return array
  */
 public function getJsConfig()
 {
     if (isset($this->wrappedComponent)) {
         return array_replace_recursive((array) $this->wrappedComponent->getData('config'), (array) $this->getData('config'));
     }
     return (array) $this->getData('config');
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:12,代碼來源:Column.php


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