Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Blocks.php
Go to the documentation of this file.
1 <?php
8 
10 {
16  public function renderPageContainers()
17  {
18  /* @var $widgetInstance \Magento\Widget\Model\Widget\Instance */
19  $widgetInstance = $this->_initWidgetInstance();
20  $layout = $this->getRequest()->getParam('layout');
21  $selected = $this->getRequest()->getParam('selected', null);
22  $blocksChooser = $this->_view->getLayout()->createBlock(
23  \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\Container::class
24  )->setValue(
25  $selected
26  )->setArea(
27  $widgetInstance->getArea()
28  )->setTheme(
29  $widgetInstance->getThemeId()
30  )->setLayoutHandle(
31  $layout
32  )->setAllowedContainers(
33  $widgetInstance->getWidgetSupportedContainers()
34  );
35  $this->setBody($blocksChooser->toHtml());
36  }
37 
43  public function execute()
44  {
45  $this->_objectManager->get(
46  \Magento\Framework\App\State::class
47  )->emulateAreaCode(
48  'frontend',
49  [$this, 'renderPageContainers']
50  );
51  }
52 }