本文整理匯總了PHP中Magento\Framework\View\Element\UiComponentInterface::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP UiComponentInterface::getName方法的具體用法?PHP UiComponentInterface::getName怎麽用?PHP UiComponentInterface::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Element\UiComponentInterface
的用法示例。
在下文中一共展示了UiComponentInterface::getName方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Constructor
*
* @param TemplateContext $context
* @param UiComponentInterface $component
* @param BlockFactory $blockWrapperFactory
* @param array $data
*/
public function __construct(TemplateContext $context, UiComponentInterface $component, BlockFactory $blockWrapperFactory, array $data = [])
{
$this->component = $component;
$this->blockWrapperFactory = $blockWrapperFactory;
$this->setNameInLayout($this->component->getName());
parent::__construct($context, $data);
}
示例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());
}
}
$config = $component->getConfiguration();
if (is_string($config)) {
$topNode[$config] = $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[$component->getName()] = $nodeData;
}
}
示例3: 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);
}
示例4: 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);
}
}
}
示例5: 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()];
}
示例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()];
}
示例7: 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;
}
示例8: 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;
}
示例9: 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);
}
示例10: 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];
}
示例11: render
/**
* Render data
*
* @param UiComponentInterface $view
* @param string $template
* @return string
*/
public function render(UiComponentInterface $view, $template = '')
{
return $view->getRenderContext()->getConfigBuilder()->toJson($view->getRenderContext()->getStorage(), $view->getName());
}