_childrenIterator = $childrenIterator; } /** * Set flyweight data * * @param array $data * @param string $scope * @return void */ public function setData(array $data, $scope) { parent::setData($data, $scope); $children = array_key_exists( 'children', $this->_data ) && is_array( $this->_data['children'] ) ? $this->_data['children'] : []; $this->_childrenIterator->setElements($children, $scope); } /** * Check whether element has visible child elements * * @return bool */ public function hasChildren() { foreach ($this->getChildren() as $child) { return (bool)$child; } return false; } /** * Retrieve children iterator * * @return \Magento\Config\Model\Config\Structure\Element\Iterator */ public function getChildren() { return $this->_childrenIterator; } /** * Check whether element is visible * * @return bool */ public function isVisible() { if (parent::isVisible()) { return $this->hasChildren() || $this->getFrontendModel(); } return false; } }