/** * @param $decorator * @param $storage * * @return array */ private function getBlocksData(EntityDecorator $decorator, EntityStorageInterface $storage) { $blocks = []; /** @var \Drupal\block\BlockInterface $block */ foreach ($decorator->getEntities() as $block) { /** @var Block $entity */ if ($entity = $storage->load($block->get('id'))) { $route = ''; if ($entity->hasLinkTemplate('edit-form')) { $route = $entity->urlInfo('edit-form')->toString(); } $id = $block->get('id'); $blocks[$id] = ['id' => $id, 'region' => $block->getRegion(), 'status' => $block->get('status'), 'theme' => $block->getTheme(), 'plugin' => $block->get('plugin'), 'settings' => $block->get('settings'), 'route' => $route]; } } return $blocks; }
/** * @param ConfigEntityStorageInterface $controller */ public function __construct(ConfigEntityStorageInterface $controller) { parent::__construct($controller); $this->entities = []; }
/** * @param EntityViewBuilderInterface $controller */ public function __construct(EntityViewBuilderInterface $controller) { parent::__construct($controller); $this->entities = []; }