/** * {@inheritdoc} */ public function getLayout(ContextInterface $context, $rootId = null) { if (!$context->isResolved()) { $this->registry->configureContext($context); $context->resolve(); } $this->layoutManipulator->applyChanges($context); $rawLayout = $this->rawLayoutBuilder->getRawLayout(); $rootView = $this->blockFactory->createBlockView($rawLayout, $context, $rootId); $layout = $this->createLayout($rootView); $rootBlockId = $rawLayout->getRootId(); $blockThemes = $rawLayout->getBlockThemes(); foreach ($blockThemes as $blockId => $themes) { $layout->setBlockTheme($themes, $blockId !== $rootBlockId ? $blockId : null); } return $layout; }
/** * @param int $index The action index * @param string $id The item id * * @return int The number of executed actions */ protected function executeDependedRemoveAction($index, $id) { $executedCount = 0; if (isset($this->links[self::REMOVE][$id])) { $executedCount += $this->executeLinkedAction(self::GROUP_REMOVE, self::REMOVE, $index, $id); } if (0 === $executedCount) { $aliases = $this->rawLayoutBuilder->getAliases($this->rawLayoutBuilder->resolveId($id)); foreach ($aliases as $alias) { $executedCount += $this->executeLinkedAction(self::GROUP_REMOVE, self::REMOVE, $index, $alias); if (0 !== $executedCount) { break; } } } if (0 === $executedCount && $this->rawLayoutBuilder->has($id)) { $parentId = $this->rawLayoutBuilder->getParentId($id); if ($parentId) { $executedCount += $this->executeDependedRemoveAction($index, $parentId); } } return $executedCount; }
/** * {@inheritdoc} */ public function getParentId() { return $this->rawLayoutBuilder->getParentId($this->id); }