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


PHP UiComponentInterface::getContext方法代碼示例

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


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

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

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

 /**
  * Generate Java Script configuration element
  *
  * @param UiComponentInterface $component
  * @return array
  */
 public function build(UiComponentInterface $component)
 {
     $children = [];
     $context = $component->getContext();
     $this->addChildren($children, $component, $component->getName());
     $dataSources = $component->getDataSourceData();
     $configuration = ['types' => $context->getComponentsDefinitions(), 'components' => [$context->getNamespace() => ['children' => array_merge($children, $dataSources)]]];
     return $configuration;
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:15,代碼來源:Generic.php

示例4: build

 /**
  * Build
  *
  * @param UiComponentInterface $component
  * @return array
  */
 public function build(UiComponentInterface $component)
 {
     $this->component = $component;
     $this->namespace = $component->getContext()->getNamespace();
     $this->addNavigationBlock();
     // Initialization of structure components
     $this->initSections();
     $this->initAreas();
     return parent::build($component);
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:16,代碼來源:Tabs.php

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

示例6: addNavigationBlock

 /**
  * Add navigation block
  *
  * @return void
  */
 protected function addNavigationBlock()
 {
     $pageLayout = $this->component->getContext()->getPageLayout();
     /** @var \Magento\Ui\Component\Layout\Tabs\Nav $navBlock */
     if (isset($this->navContainerName)) {
         $navBlock = $pageLayout->addBlock('Magento\\Ui\\Component\\Layout\\Tabs\\Nav', 'tabs_nav', $this->navContainerName);
     } else {
         $navBlock = $pageLayout->addBlock('Magento\\Ui\\Component\\Layout\\Tabs\\Nav', 'tabs_nav', 'content');
     }
     $navBlock->setTemplate('Magento_Ui::layout/tabs/nav/default.phtml');
     $navBlock->setData('data_scope', $this->namespace);
     $this->component->getContext()->addComponentDefinition('nav', ['component' => 'Magento_Ui/js/form/components/tab_group', 'config' => ['template' => 'ui/tab'], 'extends' => $this->namespace]);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:18,代碼來源:Tabs.php

示例7: getJsConfig

 /**
  * Get configuration of related JavaScript Component
  * (force extending the root component if component does not extend other component)
  *
  * @param UiComponentInterface $component
  * @return array
  */
 public function getJsConfig(UiComponentInterface $component)
 {
     $jsConfig = (array) $component->getData('js_config');
     if (!isset($jsConfig['extends'])) {
         $jsConfig['extends'] = $component->getContext()->getNamespace();
     }
     return $jsConfig;
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:15,代碼來源:AbstractComponent.php

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


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