58 $this->
namespace = $component->
getContext()->getNamespace();
60 $this->addNavigationBlock();
82 $collectedComponents = [];
84 foreach (
$component->getChildComponents() as $childComponent) {
93 $name = $childComponent->getName();
94 $config = $childComponent->getData(
'config');
95 $collectedComponents[
$name] =
true;
96 if (isset(
$config[
'is_collection']) &&
$config[
'is_collection'] ===
true) {
97 $label = $childComponent->getData(
'config/label');
98 $this->component->getContext()->addComponentDefinition(
101 'component' =>
'Magento_Ui/js/form/components/collection',
102 'extends' => $this->
namespace 110 list($childComponent,
$structure) = $this->prepareChildComponents($childComponent,
$name);
115 $name .
'_collection' => [
116 'type' =>
'collection',
119 'removeLabel' =>
__(
'Remove %1',
$label),
120 'addLabel' =>
__(
'Add New %1',
$label),
121 'removeMessage' => $childComponent->getData(
'config/removeMessage'),
122 'itemTemplate' =>
'item_template',
126 'isTemplate' =>
true,
127 'component' =>
'Magento_Ui/js/form/components/collection/item',
128 'childType' =>
'group',
132 'children' => $childrenStructure
142 list($childComponent,
$structure) = $this->prepareChildComponents($childComponent,
$name);
151 $dataScope =
'data.' .
$name;
154 $childrenAreas[
$name] = [
155 'type' => $tabComponent->getComponentName(),
156 'dataScope' => $dataScope,
159 $this->
namespace . '.sections' => [
167 $this->structure[static::AREAS_KEY][
'children'] = $childrenAreas;
178 protected function addWrappedBlock(BlockWrapperInterface $childComponent, array &$areas)
180 $name = $childComponent->getName();
182 $block = $childComponent->getBlock();
183 if (!
$block->canShowTab()) {
186 if (!
$block instanceof TabInterface) {
187 parent::addWrappedBlock($childComponent, $areas);
189 $block->setData(
'target_form', $this->
namespace);
192 if (
$block->isAjaxLoaded()) {
195 $config[
'content'] = $childComponent->getData(
'config/content') ?:
$block->toHtml();
200 'type' => $tabComponent->getComponentName(),
201 'dataScope' =>
$name,
203 $this->
namespace . '.sections' => [
208 'label' =>
$block->getTabTitle()
212 'type' =>
'html_content',
213 'dataScope' =>
$name,
230 $tabComponent = $this->uiComponentFactory->create(
234 'context' => $this->component->getContext(),
235 'components' => [$childComponent->
getName() => $childComponent]
238 $tabComponent->prepare();
239 $this->component->addComponent(
$name, $tabComponent);
241 return $tabComponent;
254 $childComponents =
$component->getChildComponents();
256 $childrenStructure = [];
257 foreach ($childComponents as $childName => $child) {
258 $isVisible = $child->getData(
'config/visible');
259 if ($isVisible !==
null && $isVisible == 0) {
266 list($childComponent, $childStructure) = $this->prepareChildComponents($child,
$component->getName());
267 $childrenStructure = array_merge($childrenStructure, $childStructure);
268 $component->addComponent($childName, $childComponent);
275 'children' => $childrenStructure
281 if ($dataScope !==
false) {
300 if (!isset(
$config[
'displayArea'])) {
301 $config[
'displayArea'] =
'body';
303 if (isset(
$config[
'dataScope'])) {
304 $dataScope =
$config[
'dataScope'];
320 $this->structure[static::SECTIONS_KEY] = [
323 'label' => $this->component->getData(
'label'),
336 $this->structure[static::AREAS_KEY] = [
350 protected function addNavigationBlock()
352 $pageLayout = $this->component->getContext()->getPageLayout();
354 $navName =
'tabs_nav';
355 if ($pageLayout->hasElement($navName)) {
356 $navName = $this->component->getName() .
'_tabs_nav';
360 if (isset($this->navContainerName)) {
361 $navBlock = $pageLayout->addBlock(
364 $this->navContainerName
367 $navBlock = $pageLayout->addBlock(\
Magento\Ui\Component\Layout\Tabs\Nav::class, $navName,
'content');
369 $navBlock->setTemplate(
'Magento_Ui::layout/tabs/nav/default.phtml');
370 $navBlock->setData(
'data_scope', $this->
namespace);
372 $this->component->getContext()->addComponentDefinition(
375 'component' =>
'Magento_Ui/js/form/components/tab_group',
377 'template' =>
'ui/tab' 379 'extends' => $this->
namespace 391 $this->sortIncrement += 10;
elseif(isset( $params[ 'redirect_parent']))
createTabComponent(UiComponentInterface $childComponent, $name)
build(UiComponentInterface $component)
prepareConfig(array $config, $name, $parentName)
__construct(UiComponentFactory $uiComponentFactory, $navContainerName=null, $data=[])
addWrappedBlock(BlockWrapperInterface $childComponent, array &$childrenNode)
if(!isset($_GET['name'])) $name