Ejemplo n.º 1
0
 /**
  * Add wrapped layout block
  *
  * @param BlockWrapperInterface $childComponent
  * @param array $childrenNode
  * @return $this
  */
 protected function addWrappedBlock(BlockWrapperInterface $childComponent, array &$childrenNode)
 {
     $config = $childComponent->getConfiguration();
     if (!$config['canShow']) {
         return $this;
     }
     $name = $childComponent->getName();
     $panelComponent = $this->createChildFormComponent($childComponent, $name);
     $childrenNode[$name] = ['type' => $panelComponent->getComponentName(), 'dataScope' => $name, 'config' => $config, 'children' => [$name => ['type' => $this->getConfig(self::CONFIG_COMPONENT_NAME), 'dataScope' => $name, 'config' => ['content' => $childComponent->render()]]]];
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Add wrapped layout block
  *
  * @param BlockWrapperInterface $childComponent
  * @param array $areas
  * @return void
  */
 protected function addWrappedBlock(BlockWrapperInterface $childComponent, array &$areas)
 {
     $name = $childComponent->getName();
     /** @var TabInterface $block */
     $block = $childComponent->getBlock();
     if (!$block->canShowTab()) {
         return;
     }
     $block->setData('target_form', $this->namespace);
     $config = [];
     if ($block->isAjaxLoaded()) {
         $config['url'] = $block->getTabUrl();
     } else {
         $config['content'] = $block->toHtml();
     }
     $tabComponent = $this->createTabComponent($childComponent, $name);
     $areas[$name] = ['type' => $tabComponent->getComponentName(), 'dataScope' => $name, 'insertTo' => [$this->namespace . '.sections' => ['position' => $block->hasSortOrder() ? $block->getSortOrder() : $this->getNextSortIncrement()]], 'config' => ['label' => $block->getTabTitle()], 'children' => [$name => ['type' => 'html_content', 'dataScope' => $name, 'config' => $config]]];
 }