Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Accordion.php
Go to the documentation of this file.
1 <?php
7 
15 {
19  protected $_items = [];
20 
24  protected $_template = 'Magento_Backend::widget/accordion.phtml';
25 
29  public function getItems()
30  {
31  return $this->_items;
32  }
33 
39  public function addItem($itemId, $config)
40  {
41  $this->_items[$itemId] = $this->getLayout()->createBlock(
42  \Magento\Backend\Block\Widget\Accordion\Item::class,
43  $this->getNameInLayout() . '-' . $itemId
44  )->setData(
45  $config
46  )->setAccordion(
47  $this
48  )->setId(
49  $itemId
50  );
51  if (isset($config['content']) && $config['content'] instanceof \Magento\Framework\View\Element\AbstractBlock) {
52  $this->_items[$itemId]->setChild($itemId . '_content', $config['content']);
53  }
54 
55  $this->setChild($itemId, $this->_items[$itemId]);
56  return $this;
57  }
58 }
$config
Definition: fraud_order.php:17