*/
protected $_type = '';
+ /**
+ * @var bool
+ */
+ protected $_menu_desktop = true;
+
+ /**
+ * @var bool
+ */
+ protected $_menu_desktop_children = true;
+
+ /**
+ * @var bool
+ */
+ protected $_menu_mobile = true;
+ /**
+ * @var bool
+ */
+ protected $_menu_mobile_children = true;
+
/**
* @var array
{
$this->_urlAliases = $urlAliases;
}
+
+ /**
+ * @param bool $menu_desktop
+ */
+ public function setMenuDesktop(bool $menu_desktop): void
+ {
+ $this->_menu_desktop = $menu_desktop;
+ }
+
+ /**
+ * @param bool $menu_desktop_children
+ */
+ public function setMenuDesktopChildren(bool $menu_desktop_children): void
+ {
+ $this->_menu_desktop_children = $menu_desktop_children;
+ }
+
+ /**
+ * @param bool $menu_mobile
+ */
+ public function setMenuMobile(bool $menu_mobile): void
+ {
+ $this->_menu_mobile = $menu_mobile;
+ }
+
+ /**
+ * @param bool $menu_mobile_children
+ */
+ public function setMenuMobileChildren(bool $menu_mobile_children): void
+ {
+ $this->_menu_mobile_children = $menu_mobile_children;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isMenuDesktop(): bool
+ {
+ return $this->_menu_desktop;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isMenuDesktopChildren(): bool
+ {
+ return $this->isMenuDesktop() && $this->_menu_desktop_children;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isMenuMobile(): bool
+ {
+ return $this->_menu_mobile;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isMenuMobileChildren(): bool
+ {
+ return $this->isMenuMobile() && $this->_menu_mobile_children;
+ }
+
+ public function hideInAllMenus()
+ {
+ $this->_allMenus(false);
+ }
+
+ public function showInAllMenus()
+ {
+ $this->_allMenus(true);
+ }
+
+ protected function _allMenus(bool $val)
+ {
+ $this->setMenuDesktop($val);
+ $this->setMenuMobile($val);
+ $this->setMenuDesktopChildren($val);
+ $this->setMenuMobileChildren($val);
+ }
}
$this->setName($entity->name ?? get_class($entity) . '_' . $entity->id);
$this->setSlug($entity->slug);
$this->setTitle($entity->title);
+
+ $this->setMenuDesktop($entity->menu_desktop != 'no');
+ $this->setMenuDesktopChildren($entity->menu_desktop == 'children');
+
+ $mobile = $entity->menu_mobile == 'desktop' ? $entity->menu_desktop : $entity->menu_mobile;
+ $this->setMenuMobile($mobile != 'no');
+ $this->setMenuMobileChildren($mobile == 'children');
+
$dbaliases = $entity->getPageData()->url_alias;
if (is_array($dbaliases)) {
$aliases = [];
{
if ($this->getPage() instanceof CMSPage) {
$template = $this->getPage()->getUsedTemplate();
- if(null!==$template) {
+ if (null !== $template) {
$template->setMenuChildren($this);
}
}
public function isVirtual()
{
if (null === $this->_isVirtual) {
- if ($this->getPage() instanceof CMSPage && null!==$this->getPage()->getUsedTemplate()) {
+ if ($this->getPage() instanceof CMSPage && null !== $this->getPage()->getUsedTemplate()) {
$this->_isVirtual = $this->getPage()->getUsedTemplate()->isVirtual();
} else {
$this->_isVirtual = false;