Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Container.php
Go to the documentation of this file.
1 <?php
7 
10 
14 class Container extends AbstractBlock
15 {
19  const DEFAULT_CONTROL = \Magento\Ui\Component\Control\Button::class;
20  const SPLIT_BUTTON = \Magento\Ui\Component\Control\SplitButton::class;
21 
29  protected function createButton($blockName, $blockClassName = null)
30  {
31  if (null === $blockClassName) {
32  $blockClassName = static::DEFAULT_CONTROL;
33  }
34 
35  return $this->getLayout()->createBlock($blockClassName, $blockName);
36  }
37 
43  protected function _toHtml()
44  {
46  $item = $this->getButtonItem();
47  $data = $item->getData();
48 
49  $contextPrefixName = $this->getData('context') ? ($this->getData('context')->getNameInLayout() . '-') : '';
50  $block = $this->createButton(
51  $contextPrefixName . $item->getId() . '-button',
52  isset($data['class_name']) ? $data['class_name'] : null
53  );
54  $block->setData($data);
55  return $block->toHtml();
56  }
57 }
getData($key='', $index=null)
Definition: DataObject.php:119
createButton($blockName, $blockClassName=null)
Definition: Container.php:29
$block
Definition: block.php:8