*/
protected $_menu_mobile_children = true;
+ /**
+ * @var bool
+ */
+ protected $_robots = true;
+
/**
* @var array
return $this->_menu_mobile;
}
+ /**
+ * @param bool $robots
+ */
+ public function setRobots(bool $robots): void
+ {
+ $this->_robots = $robots;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isRobots(): bool
+ {
+ return $this->_robots;
+ }
+
/**
* @return bool
*/
* @param $page CubistMagicPageModel
* @param $all CubistMagicPageModel[]
*/
- public function initFromPage($page, $all)
+ public function initFromPage($page, $all = null)
{
$this->initFromEntity($page);
$this->setPage($page);
- $this->setChildrenFromData($all, $this->getId());
- $this->setChildrenFromTemplate();
+ if (null !== $all) {
+ $this->setChildrenFromData($all, $this->getId());
+ $this->setChildrenFromTemplate();
+ }
}
/**
*/
public function initFromEntity($entity)
{
+ $data=$entity->getPageData();
$this->setId($entity->id);
$this->setName($entity->name ?? get_class($entity) . '_' . $entity->id);
$this->setSlug($entity->slug);
$this->setTitle($entity->title);
+ $this->setRobots($data->get('robots',true));
$desktop = $entity->menu_desktop == '' ? 'children' : $entity->menu_desktop;
class VirtualItem extends Item
{
protected $_href = '#';
- protected $_classes=['nav-virtual'];
+ protected $_classes = ['nav-virtual'];
public function isNavigable()
{
return false;
}
+
+ public function isRobots(): bool
+ {
+ return false;
+ }
}