17 class Block implements Layout\GeneratorInterface
69 private $defaultClass;
91 $defaultClass = Template::class
101 $this->defaultClass = $defaultClass;
125 $layout = $generatorContext->getLayout();
126 $structure = $generatorContext->getStructure();
133 if (
$type === self::TYPE) {
138 if (!empty(
$data[
'actions'])) {
141 }
catch (\Exception $e) {
150 $block->setLayout($layout);
151 $this->eventManager->dispatch(
'core_layout_block_create_after', [
'block' =>
$block]);
152 }
catch (\Exception $e) {
156 $this->exceptionHandlerBlockFactory->create([
'blockName' =>
$elementName])
165 foreach ($actions as $action) {
166 list($methodName, $actionArguments, $configPath, $scopeType) = $action;
167 if (empty($configPath)
168 || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope())
173 }
catch (\Exception $e) {
177 $this->exceptionHandlerBlockFactory->create([
'blockName' =>
$elementName])
270 }
catch (\ReflectionException $e) {
271 $this->logger->critical($e->getMessage());
275 throw new \Magento\Framework\Exception\LocalizedException(
277 'Invalid block type: %1',
296 $profilerKey =
'BLOCK_ACTION:' .
$block->getNameInLayout() .
'>' . $methodName;
297 \Magento\Framework\Profiler::start($profilerKey);
299 call_user_func_array([
$block, $methodName], $args);
300 \Magento\Framework\Profiler::stop($profilerKey);
312 foreach (
$arguments as $argumentName => $argumentData) {
313 if (!isset($argumentData[Dom::TYPE_ATTRIBUTE])) {
314 $result[$argumentName] = $argumentData;
317 $result[$argumentName] = $this->argumentInterpreter->evaluate($argumentData);
getBlockInstance($block, array $arguments=[])
$exceptionHandlerBlockFactory
handleRenderException(\Exception $cause)
generateAction($block, $methodName, $actionArguments)
generateBlock(Layout\ScheduledStructure $scheduledStructure, Layout\Data\Structure $structure, $elementName)
evaluateArguments(array $arguments)
process(Reader\Context $readerContext, Generator\Context $generatorContext)
__construct(\Magento\Framework\View\Element\BlockFactory $blockFactory, \Magento\Framework\Data\Argument\InterpreterInterface $argumentInterpreter, \Magento\Framework\Event\ManagerInterface $eventManager, \Psr\Log\LoggerInterface $logger, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\ScopeResolverInterface $scopeResolver, \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory, State $appState, $defaultClass=Template::class)
createBlock($block, $name, array $arguments=[])
if(!isset($_GET['name'])) $name