Newer
Older

Henning Leutz
committed
<?php
namespace QUI\Menu\Mega;
use QUI;
use QUI\Exception;
use QUI\Interfaces\Projects\Site;

Henning Leutz
committed
/**
* Class AbstractMenu
* Starting point for menu controls
*
* @package QUI\Menu
*/
abstract class AbstractChild extends QUI\Control
{
/**
* @var null|array
*/

Henning Leutz
committed
/**
* Return the current site
*

Henning Leutz
committed
*/
protected function getSite(): QUI\Interfaces\Projects\Site

Henning Leutz
committed
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
}
return QUI::getRewrite()->getSite();
}
/**
* @return array|null
* @throws Exception

Henning Leutz
committed
*/

Henning Leutz
committed
{
if (is_null($this->children)) {
$this->children = $this->getSite()->getNavigation();
}
return $this->children;
}
/**
* Returns the number of children
*
* @return int

Henning Leutz
committed
*/
public function count(): int

Henning Leutz
committed
{
return count($this->getChildren());
}
}