Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractComposite.php
Go to the documentation of this file.
1 <?php
7 
12 abstract class AbstractComposite extends \Magento\Config\Model\Config\Structure\AbstractElement
13 {
19  protected $_childrenIterator;
20 
26  public function __construct(
28  \Magento\Framework\Module\Manager $moduleManager,
29  Iterator $childrenIterator
30  ) {
31  parent::__construct($storeManager, $moduleManager);
32  $this->_childrenIterator = $childrenIterator;
33  }
34 
42  public function setData(array $data, $scope)
43  {
44  parent::setData($data, $scope);
45  $children = array_key_exists(
46  'children',
47  $this->_data
48  ) && is_array(
49  $this->_data['children']
50  ) ? $this->_data['children'] : [];
51  $this->_childrenIterator->setElements($children, $scope);
52  }
53 
59  public function hasChildren()
60  {
61  foreach ($this->getChildren() as $child) {
62  return (bool)$child;
63  }
64  return false;
65  }
66 
72  public function getChildren()
73  {
75  }
76 
82  public function isVisible()
83  {
84  if (parent::isVisible()) {
85  return $this->hasChildren() || $this->getFrontendModel();
86  }
87  return false;
88  }
89 }
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Module\Manager $moduleManager, Iterator $childrenIterator)
$storeManager
$children
Definition: actions.phtml:11