/** * @param WidgetManagerInterface $widgetManager * @param int $pageId */ public function __construct(WidgetManagerInterface $widgetManager, $pageId) { parent::__construct(); $this->widgetManager = $widgetManager; $widgets = $widgetManager->getWidgetsByPage($pageId); $blocks = $widgetManager->getPageWidgetBlocks($pageId); foreach ($widgets as $widget) { $this->addWidget($widget, array_get($blocks, $widget->getId() . '.0'), array_get($blocks, $widget->getId() . '.1')); } }