diff --git a/Classes/Domain/Model/Menu.php b/Classes/Domain/Model/Menu.php index 323c09293e481624b12a8cacaed4e8c44d921b98..ee51ae8ea8e11601a8bef400d9662d05444ea59a 100644 --- a/Classes/Domain/Model/Menu.php +++ b/Classes/Domain/Model/Menu.php @@ -1,7 +1,11 @@ <?php +declare(strict_types=1); + namespace NL\NlMenubuilder\Domain\Model; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + /*** * * This file is part of the "Menu Builder" Extension for TYPO3 CMS. @@ -9,65 +13,47 @@ namespace NL\NlMenubuilder\Domain\Model; * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * - * (c) 2021 + * (c) 2021 * ***/ /** * Menu */ -class Menu extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class Menu extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements MenuInterface { + use MenuTrait; + + const DEFAULT_TEMPLATE = 'Default'; /** * Name of the menu - * + * * @var string * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $title = ''; /** - * menuGroup - * - * @var \NL\NlMenubuilder\Domain\Model\MenuGroup + * template + * + * @var string + * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ - protected $menuGroup = null; + protected $template = self::DEFAULT_TEMPLATE; /** - * menuItem - * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\NL\NlMenubuilder\Domain\Model\MenuItem> + * items + * + * @var ObjectStorage<MenuItem> * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") */ - protected $menuItem = null; - - /** - * Returns the title - * - * @return string $title - */ - public function getTitle() - { - return $this->title; - } - - /** - * Sets the title - * - * @param string $title - * @return void - */ - public function setTitle($title) - { - $this->title = $title; - } + protected $items = null; /** * __construct */ public function __construct() { - //Do not remove the next line: It would break the functionality $this->initStorageObjects(); } @@ -77,123 +63,96 @@ class Menu extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * Do not modify this method! * It will be rewritten on each save in the extension builder * You may modify the constructor of this class instead - * + * * @return void */ protected function initStorageObjects() { - $this->menuItem = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $this->items = $this->items ?: new ObjectStorage(); } /** - * @return array - */ - public function getMenuItemPages(): array - { - return $this->getMenuItemByType(MenuItem::TYPE_PAGE); - } - - /** - * @return array - */ - public function getMenuItemLinks(): array - { - return $this->getMenuItemByType(MenuItem::TYPE_LINK); - } - - /** - * @return array - */ - public function getMenuItemContents(): array - { - return $this->getMenuItemByType(MenuItem::TYPE_CONTENT); - } - - /** - * @return array + * Returns the title + * + * @return string $title */ - public function getMenuItemSubmenus(): array + public function getTitle(): string { - return $this->getMenuItemByType(MenuItem::TYPE_SUBMENU); + return $this->title; } /** - * @param int $type - * @return array + * Sets the title + * + * @param string $title + * @return void */ - public function getMenuItemByType(int $type): array + public function setTitle(string $title): string { - if ($items = $this->getMenuItem()) { - return array_filter($items->toArray(), function ($item) use ($type) { - /** @var MenuItem $item */ - return $item->getType() === $type; - }); - } - - return []; + $this->title = $title; } /** - * Returns the menuGroup - * - * @return \NL\NlMenubuilder\Domain\Model\MenuGroup menuGroup + * Returns the template + * + * @return string $template */ - public function getMenuGroup() + public function getTemplate(): string { - return $this->menuGroup; + return $this->template; } /** - * Sets the menuGroup - * - * @param \NL\NlMenubuilder\Domain\Model\MenuGroup $menuGroup + * Sets the template + * + * @param string $template * @return void */ - public function setMenuGroup(\NL\NlMenubuilder\Domain\Model\MenuGroup $menuGroup) + public function setTemplate(string $template): void { - $this->menuGroup = $menuGroup; + $this->template = $template; } /** * Adds a MenuItem - * - * @param \NL\NlMenubuilder\Domain\Model\MenuItem $menuItem + * + * @param MenuItem $item * @return void */ - public function addMenuItem(\NL\NlMenubuilder\Domain\Model\MenuItem $menuItem) + public function addItem(MenuItem $item): void { - $this->menuItem->attach($menuItem); + $this->items->attach($item); } /** * Removes a MenuItem - * - * @param \NL\NlMenubuilder\Domain\Model\MenuItem $menuItemToRemove The MenuItem to be removed + * + * @param MenuItem $itemToRemove The MenuItem to be removed * @return void */ - public function removeMenuItem(\NL\NlMenubuilder\Domain\Model\MenuItem $menuItemToRemove) + public function removeItem(MenuItem $itemToRemove): void { - $this->menuItem->detach($menuItemToRemove); + $this->items->detach($itemToRemove); } /** - * Returns the menuItem - * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\NL\NlMenubuilder\Domain\Model\MenuItem> menuItem + * Returns the items + * + * @return ObjectStorage<MenuItem> items */ - public function getMenuItem() + public function getItems(): ?ObjectStorage { - return $this->menuItem; + return $this->items; } /** - * Sets the menuItem - * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\NL\NlMenubuilder\Domain\Model\MenuItem> $menuItem + * Sets the items + * + * @param ObjectStorage<MenuItem> $items * @return void */ - public function setMenuItem(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $menuItem) + public function setItems(ObjectStorage $items): void { - $this->menuItem = $menuItem; + $this->items = $items; } } diff --git a/Classes/Domain/Model/MenuGroup.php b/Classes/Domain/Model/MenuGroup.php deleted file mode 100644 index e37a5ab50d112b152a27a94150041708af2056aa..0000000000000000000000000000000000000000 --- a/Classes/Domain/Model/MenuGroup.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -namespace NL\NlMenubuilder\Domain\Model; - - -/*** - * - * This file is part of the "Menu Builder" Extension for TYPO3 CMS. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * (c) 2021 - * - ***/ -/** - * MenuGroup - */ -class MenuGroup extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity -{ - - /** - * Name of the menu group - * - * @var string - * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") - */ - protected $title = ''; - - /** - * Name of the template - * - * @var string - * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") - */ - protected $template = ''; - - /** - * __construct - */ - public function __construct() - { - - //Do not remove the next line: It would break the functionality - $this->initStorageObjects(); - } - - /** - * Initializes all ObjectStorage properties - * Do not modify this method! - * It will be rewritten on each save in the extension builder - * You may modify the constructor of this class instead - * - * @return void - */ - protected function initStorageObjects() - { - } - - /** - * Returns the title - * - * @return string title - */ - public function getTitle() - { - return $this->title; - } - - /** - * Sets the title - * - * @param string $title - * @return void - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Returns the template - * - * @return string title - */ - public function getTemplate() - { - return $this->template; - } - - /** - * Sets the template - * - * @param string $template - * @return void - */ - public function setTemplate($template) - { - $this->template = $template; - } -} diff --git a/Classes/Domain/Model/MenuInterface.php b/Classes/Domain/Model/MenuInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..bb1117f0a368570d4e604f337a0169cd06d5650d --- /dev/null +++ b/Classes/Domain/Model/MenuInterface.php @@ -0,0 +1,24 @@ +<?php + + +namespace NL\NlMenubuilder\Domain\Model; + + +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + +interface MenuInterface +{ + public function getTitle(): string; + + public function getItems(): ?ObjectStorage; + + public function getItemsByType(int $type): array; + + public function getPageItems(): array; + + public function getLinkItems(): array; + + public function getContentItems(): array; + + public function getSubmenuItems(): array; +} diff --git a/Classes/Domain/Model/MenuItem.php b/Classes/Domain/Model/MenuItem.php index 14db26326322c07af72d22cd8025e8ff593164f9..2f6aed42064df0a983fa7c5291397ed65f7970f2 100644 --- a/Classes/Domain/Model/MenuItem.php +++ b/Classes/Domain/Model/MenuItem.php @@ -1,7 +1,13 @@ <?php +declare(strict_types=1); namespace NL\NlMenubuilder\Domain\Model; + +use TYPO3\CMS\Extbase\Domain\Model\FileReference; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + /*** * * This file is part of the "Menu Builder" Extension for TYPO3 CMS. @@ -15,7 +21,7 @@ namespace NL\NlMenubuilder\Domain\Model; /** * MenuItem */ -class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class MenuItem extends AbstractEntity { const TYPE_PAGE = 0; const TYPE_LINK = 1; @@ -48,18 +54,11 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Optional link image * - * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference + * @var FileReference * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") */ protected $image = null; - /** - * page - * - * @var string - */ - protected $page = ''; - /** * link * @@ -75,12 +74,41 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity protected $content = ''; /** - * submenu + * items * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\NL\NlMenubuilder\Domain\Model\Menu> + * @var ObjectStorage<MenuItem> * @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") */ - protected $submenu = null; + protected $items = null; + + /** + * page + * + * @var Page + */ + protected $page = null; + + /** + * __construct + */ + public function __construct() + { + //Do not remove the next line: It would break the functionality + $this->initStorageObjects(); + } + + /** + * Initializes all ObjectStorage properties + * Do not modify this method! + * It will be rewritten on each save in the extension builder + * You may modify the constructor of this class instead + * + * @return void + */ + protected function initStorageObjects() + { + $this->items = $this->items ?: new ObjectStorage(); + } /** * Get type name of the menu item. @@ -108,7 +136,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * * @return string $title */ - public function getTitle() + public function getTitle(): string { return $this->title; } @@ -119,7 +147,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param string $title * @return void */ - public function setTitle($title) + public function setTitle(string $title): void { $this->title = $title; } @@ -129,7 +157,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * * @return int $type */ - public function getType() + public function getType(): int { return $this->type; } @@ -140,7 +168,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param int $type * @return void */ - public function setType($type) + public function setType(int $type): void { $this->type = $type; } @@ -150,7 +178,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * * @return string $subtitle */ - public function getSubtitle() + public function getSubtitle(): string { return $this->subtitle; } @@ -161,7 +189,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param string $subtitle * @return void */ - public function setSubtitle($subtitle) + public function setSubtitle(string $subtitle): void { $this->subtitle = $subtitle; } @@ -169,9 +197,9 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the image * - * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image + * @return FileReference $image */ - public function getImage() + public function getImage(): ?FileReference { return $this->image; } @@ -179,41 +207,20 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the image * - * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image + * @param FileReference $image * @return void */ - public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) + public function setImage(FileReference $image): void { $this->image = $image; } - /** - * Returns the page - * - * @return string $page - */ - public function getPage() - { - return $this->page; - } - - /** - * Sets the page - * - * @param string $page - * @return void - */ - public function setPage($page) - { - $this->page = $page; - } - /** * Returns the link * * @return string $link */ - public function getLink() + public function getLink(): string { return $this->link; } @@ -224,7 +231,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param string $link * @return void */ - public function setLink($link) + public function setLink(string $link): void { $this->link = $link; } @@ -234,7 +241,7 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * * @return string $content */ - public function getContent() + public function getContent(): string { return $this->content; } @@ -245,74 +252,72 @@ class MenuItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param string $content * @return void */ - public function setContent($content) + public function setContent(string $content): void { $this->content = $content; } /** - * __construct + * Adds a MenuItem + * + * @param MenuItem $item + * @return void */ - public function __construct() + public function addItem(MenuItem $item): void { - - //Do not remove the next line: It would break the functionality - $this->initStorageObjects(); + $this->items->attach($item); } /** - * Initializes all ObjectStorage properties - * Do not modify this method! - * It will be rewritten on each save in the extension builder - * You may modify the constructor of this class instead + * Removes a MenuItem * + * @param MenuItem $itemToRemove The MenuItem to be removed * @return void */ - protected function initStorageObjects() + public function removeItem(MenuItem $itemToRemove): void { - $this->submenu = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $this->items->detach($itemToRemove); } /** - * Adds a Menu + * Returns the items * - * @param \NL\NlMenubuilder\Domain\Model\Menu $submenu - * @return void + * @return ObjectStorage<MenuItem> $items */ - public function addSubmenu(\NL\NlMenubuilder\Domain\Model\Menu $submenu) + public function getItems(): ?ObjectStorage { - $this->submenu->attach($submenu); + return $this->items; } /** - * Removes a Menu + * Sets the items * - * @param \NL\NlMenubuilder\Domain\Model\Menu $submenuToRemove The Menu to be removed + * @param ObjectStorage<MenuItem> $items * @return void */ - public function removeSubmenu(\NL\NlMenubuilder\Domain\Model\Menu $submenuToRemove) + public function setItems(ObjectStorage $items): void { - $this->submenu->detach($submenuToRemove); + $this->items = $items; } /** - * Returns the submenu + * Returns the page * - * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\NL\NlMenubuilder\Domain\Model\Menu> $submenu + * @return Page $page */ - public function getSubmenu() + public function getPage(): ?Page { - return $this->submenu->current(); + return $this->page; } /** - * Sets the submenu + * Sets the page * - * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\NL\NlMenubuilder\Domain\Model\Menu> $submenu + * @param Page $page * @return void */ - public function setSubmenu(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $submenu) + public function setPage(Page $page): void { - $this->submenu = $submenu; + $this->page = $page; } } diff --git a/Classes/Domain/Model/MenuItemContent.php b/Classes/Domain/Model/MenuItemContent.php new file mode 100644 index 0000000000000000000000000000000000000000..4146f1252af39a42ae21ed9701b5f4ea66859c4e --- /dev/null +++ b/Classes/Domain/Model/MenuItemContent.php @@ -0,0 +1,10 @@ +<?php + + +namespace NL\NlMenubuilder\Domain\Model; + + +class MenuItemContent extends MenuItem +{ + +} diff --git a/Classes/Domain/Model/MenuItemLink.php b/Classes/Domain/Model/MenuItemLink.php new file mode 100644 index 0000000000000000000000000000000000000000..bdf7f3159fb6e81229b4c5cc99a9aeeb2919a7ff --- /dev/null +++ b/Classes/Domain/Model/MenuItemLink.php @@ -0,0 +1,10 @@ +<?php + + +namespace NL\NlMenubuilder\Domain\Model; + + +class MenuItemLink extends MenuItem +{ + +} diff --git a/Classes/Domain/Model/MenuItemPage.php b/Classes/Domain/Model/MenuItemPage.php new file mode 100644 index 0000000000000000000000000000000000000000..f64b1a78fff499d17d2c3d78dbad149829daf923 --- /dev/null +++ b/Classes/Domain/Model/MenuItemPage.php @@ -0,0 +1,29 @@ +<?php + + +namespace NL\NlMenubuilder\Domain\Model; + + +use TYPO3\CMS\Extbase\Reflection\ObjectAccess; + +class MenuItemPage extends MenuItem +{ + /** + * @return string + */ + public function getTitle(): string + { + return $this->title ?: + ObjectAccess::getPropertyPath($this, 'page.navTitle') ?: + ObjectAccess::getPropertyPath($this, 'page.title'); + } + + /** + * @return string + */ + public function getSubtitle(): string + { + return $this->subtitle ?: + ObjectAccess::getPropertyPath($this, 'page.subtitle'); + } +} diff --git a/Classes/Domain/Model/MenuItemSubmenu.php b/Classes/Domain/Model/MenuItemSubmenu.php new file mode 100644 index 0000000000000000000000000000000000000000..36ed1d5603fcbcaf560d05b726eff9904aece1d9 --- /dev/null +++ b/Classes/Domain/Model/MenuItemSubmenu.php @@ -0,0 +1,10 @@ +<?php + + +namespace NL\NlMenubuilder\Domain\Model; + + +class MenuItemSubmenu extends MenuItem implements MenuInterface +{ + use MenuTrait; +} diff --git a/Classes/Domain/Model/MenuTrait.php b/Classes/Domain/Model/MenuTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..431840287b990f40f398f8b1a212528072e7c52b --- /dev/null +++ b/Classes/Domain/Model/MenuTrait.php @@ -0,0 +1,83 @@ +<?php + + +namespace NL\NlMenubuilder\Domain\Model; + + +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + +trait MenuTrait +{ + /** + * Returns the title + * + * @return string $title + */ + public function getTitle(): string + { + return $this->title; + } + + /** + * Returns the items + * + * @return ObjectStorage<MenuItem> items + */ + public function getItems(): ?ObjectStorage + { + return $this->items; + } + + /** + * @return array + */ + public function getPageItems(): array + { + return $this->getItemsByType(MenuItem::TYPE_PAGE); + } + + /** + * @return array + */ + public function getLinkItems(): array + { + return $this->getItemsByType(MenuItem::TYPE_LINK); + } + + /** + * @return array + */ + public function getContentItems(): array + { + return $this->getItemsByType(MenuItem::TYPE_CONTENT); + } + + /** + * @return array + */ + public function getSubmenuItems(): array + { + return $this->getItemsByType(MenuItem::TYPE_SUBMENU); + } + + /** + * @param int $type + * @return array + */ + public function getItemsByType(int $type): array + { + if ($items = $this->getItems()) { + + return array_filter( + $items->toArray(), + function ($item) use($type) { + + /** @var MenuItem $item */ + return $item->getType() === $type; + } + ); + } + + return []; + } +} diff --git a/Classes/Domain/Model/Page.php b/Classes/Domain/Model/Page.php new file mode 100644 index 0000000000000000000000000000000000000000..f557b2bc9b23856f42d8a46761b23581c5fdbf4a --- /dev/null +++ b/Classes/Domain/Model/Page.php @@ -0,0 +1,106 @@ +<?php +declare(strict_types=1); + +namespace NL\NlMenubuilder\Domain\Model; + + +/*** + * + * This file is part of the "Menu Builder" Extension for TYPO3 CMS. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * (c) 2021 + * + ***/ +/** + * Page + */ +class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +{ + + /** + * title + * + * @var string + */ + protected $title = ''; + + /** + * navTitle + * + * @var string + */ + protected $navTitle = ''; + + /** + * subtitle + * + * @var string + */ + protected $subtitle = ''; + + /** + * Returns the title + * + * @return string $title + */ + public function getTitle() + { + return $this->title; + } + + /** + * Sets the title + * + * @param string $title + * @return void + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * Returns the navTitle + * + * @return string $navTitle + */ + public function getNavTitle() + { + return $this->navTitle; + } + + /** + * Sets the navTitle + * + * @param string $navTitle + * @return void + */ + public function setNavTitle($navTitle) + { + $this->navTitle = $navTitle; + } + + /** + * Returns the subtitle + * + * @return string $subtitle + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * Sets the subtitle + * + * @param string $subtitle + * @return void + */ + public function setSubtitle($subtitle) + { + $this->subtitle = $subtitle; + } +} diff --git a/Classes/Domain/Repository/MenuGroupRepository.php b/Classes/Domain/Repository/MenuGroupRepository.php deleted file mode 100644 index b399d90ab70953570d7fc85ef50557368b04053e..0000000000000000000000000000000000000000 --- a/Classes/Domain/Repository/MenuGroupRepository.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -namespace NL\NlMenubuilder\Domain\Repository; - - -/*** - * - * This file is part of the "Menu Builder" Extension for TYPO3 CMS. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * (c) 2021 - * - ***/ -/** - * The repository for MenuGroups - */ -class MenuGroupRepository extends \TYPO3\CMS\Extbase\Persistence\Repository -{ -} diff --git a/Classes/Domain/Repository/MenuRepository.php b/Classes/Domain/Repository/MenuRepository.php index 12eb34c82094cb51e4170b1828a4596df93dc642..91cc7112cbdf218a0b5435af9697f62dd141b0f0 100644 --- a/Classes/Domain/Repository/MenuRepository.php +++ b/Classes/Domain/Repository/MenuRepository.php @@ -1,4 +1,6 @@ <?php +declare(strict_types=1); + namespace NL\NlMenubuilder\Domain\Repository; diff --git a/Classes/Hooks/ItemsProcFunc.php b/Classes/Hooks/ItemsProcFunc.php index e265887d0528368c7cb9fc7e11703ecc20fa210d..376f2584d59632134a4d0fceb49f0b60fd015f58 100644 --- a/Classes/Hooks/ItemsProcFunc.php +++ b/Classes/Hooks/ItemsProcFunc.php @@ -2,7 +2,6 @@ namespace NL\NlMenubuilder\Hooks; -use TYPO3\CMS\Core\Utility\DebugUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Fluid\View\TemplatePaths; @@ -11,7 +10,7 @@ class ItemsProcFunc { protected $extensionKey = 'nl_menubuilder'; - protected $langPrefix = 'LLL:EXT:nl_menubuilder/Resources/Private/Language/locallang_db.xlf:tx_nlmenubuilder_domain_model_menugroup.template.I.'; + protected $langPrefix = 'LLL:EXT:nl_menubuilder/Resources/Private/Language/locallang_db.xlf:tx_nlmenubuilder_domain_model_menu.template.I.'; /** * @var ObjectManager @@ -44,7 +43,7 @@ class ItemsProcFunc $templates = []; foreach ($paths[TemplatePaths::CONFIG_TEMPLATEROOTPATHS] as $templatePath) { - $templatePath .= 'ViewHelpers' . DIRECTORY_SEPARATOR . 'Widget'. DIRECTORY_SEPARATOR . 'Show'; + $templatePath .= 'ViewHelpers' . DIRECTORY_SEPARATOR . 'Menu'. DIRECTORY_SEPARATOR . 'Render'; $foundTemplates = GeneralUtility::getFilesInDir($templatePath, 'html'); $templates = array_merge($templates, $foundTemplates); diff --git a/Classes/ViewHelpers/Menu/Controller/RenderController.php b/Classes/ViewHelpers/Menu/Controller/RenderController.php new file mode 100644 index 0000000000000000000000000000000000000000..b23855cc9fc747514ec689422b794bc5184679c9 --- /dev/null +++ b/Classes/ViewHelpers/Menu/Controller/RenderController.php @@ -0,0 +1,38 @@ +<?php + +namespace NL\NlMenubuilder\ViewHelpers\Menu\Controller; + +use NL\NlMenubuilder\Domain\Model\Menu; +use NL\NlMenubuilder\Domain\Repository\MenuRepository; +use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController; + +class RenderController extends AbstractWidgetController +{ + /** + * @var MenuRepository + */ + protected $menuRepository; + + /** + * Inject menu repository + * + * @param MenuRepository $repository + */ + public function injectMenuRepository(MenuRepository $repository) + { + $this->menuRepository = $repository; + } + + /** + * @return string + */ + public function indexAction(): string + { + /** @var Menu $menu */ + $menu = $this->menuRepository->findByIdentifier($this->widgetConfiguration['uid']); + + $this->view->assign('menu', $menu); + + return $this->view->render($menu ? $menu->getTemplate() : Menu::DEFAULT_TEMPLATE); + } +} diff --git a/Classes/ViewHelpers/GetViewHelper.php b/Classes/ViewHelpers/Menu/GetViewHelper.php similarity index 89% rename from Classes/ViewHelpers/GetViewHelper.php rename to Classes/ViewHelpers/Menu/GetViewHelper.php index 8ad70e6037862175581d7de769b86b7be641837d..a2339f9387656c54e1021f3aba365b7ee749e5c2 100644 --- a/Classes/ViewHelpers/GetViewHelper.php +++ b/Classes/ViewHelpers/Menu/GetViewHelper.php @@ -1,7 +1,6 @@ <?php - -namespace NL\NlMenubuilder\ViewHelpers; +namespace NL\NlMenubuilder\ViewHelpers\Menu; use FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait; use NL\NlMenubuilder\Domain\Repository\MenuRepository; @@ -11,7 +10,6 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic; - class GetViewHelper extends AbstractViewHelper { use CompileWithRenderStatic; @@ -33,7 +31,7 @@ class GetViewHelper extends AbstractViewHelper public function initializeArguments(): void { $this->registerAsArgument(); - $this->registerArgument('uuid', 'int', 'UUID of the menu', true, 0); + $this->registerArgument('uid', 'int', 'UID of the menu', true, 0); } /** @@ -52,12 +50,10 @@ class GetViewHelper extends AbstractViewHelper $menuRepository = $objectManager->get(MenuRepository::class); return static::renderChildrenWithVariableOrReturnInputStatic( - $menuRepository->findByUid($arguments['uuid'] ?? 0), + $menuRepository->findByUid($arguments['uid'] ?? 0), $arguments['as'], $renderingContext, $renderChildrenClosure ); - - } } diff --git a/Classes/ViewHelpers/Menu/RenderViewHelper.php b/Classes/ViewHelpers/Menu/RenderViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..58bedd502de8985d8bf7d6d283fb21b26a9ccfed --- /dev/null +++ b/Classes/ViewHelpers/Menu/RenderViewHelper.php @@ -0,0 +1,42 @@ +<?php + +namespace NL\NlMenubuilder\ViewHelpers\Menu; + +use NL\NlMenubuilder\ViewHelpers\Menu\Controller\RenderController; +use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper; + +class RenderViewHelper extends AbstractWidgetViewHelper +{ + /** + * @var RenderController + */ + protected $controller; + + /** + * Inject controller + * + * @param RenderController $controller + */ + public function injectController(RenderController $controller): void + { + $this->controller = $controller; + } + + /** + * Initialize arguments + * + * @return void + */ + public function initializeArguments(): void + { + $this->registerArgument('uid', 'int', 'UID of the menu', true); + } + + /** + * @return \TYPO3\CMS\Extbase\Mvc\ResponseInterface + */ + public function render(): \TYPO3\CMS\Extbase\Mvc\ResponseInterface + { + return $this->initiateSubRequest(); + } +} diff --git a/Classes/ViewHelpers/Widget/Controller/ShowController.php b/Classes/ViewHelpers/Widget/Controller/ShowController.php deleted file mode 100644 index b34c6e7ac6c0e0184f073cdcffd3d58a62419a78..0000000000000000000000000000000000000000 --- a/Classes/ViewHelpers/Widget/Controller/ShowController.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -namespace NL\NlMenubuilder\ViewHelpers\Widget\Controller; - -use NL\NlMenubuilder\Domain\Model\Menu; -use NL\NlMenubuilder\Domain\Repository\MenuRepository; -use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController; - -class ShowController extends AbstractWidgetController -{ - /** - * Model object instance of root menu. - * - * @var Menu - */ - protected $menu; - - /** - * Menu group template. - * - * @var string - */ - protected $template; - - /** - * @var MenuRepository - */ - protected $menuRepository; - - /** - * Inject menu repository - * - * @param MenuRepository $controller - */ - public function injectMenuRepository(MenuRepository $menuRepository) - { - $this->menuRepository = $menuRepository; - } - - /** - * Main action - */ - public function indexAction() - { - $this->view->assign('menu', $this->menu); - - return $this->view->render($this->template); - } - - /** - * @return array - */ - public function initializeAction() - { - $uuid = $this->widgetConfiguration['uuid'] ?? 0; - $menu = $this->menuRepository->findByUid($uuid); - - if (!is_null($menu)) { - $this->menu = $menu; - $this->template = $this->menu->getMenuGroup()->getTemplate(); - } - } -} diff --git a/Classes/ViewHelpers/Widget/ShowViewHelper.php b/Classes/ViewHelpers/Widget/ShowViewHelper.php deleted file mode 100644 index 28e979f6599a88fff9e0c37caffc5d0eb967e3db..0000000000000000000000000000000000000000 --- a/Classes/ViewHelpers/Widget/ShowViewHelper.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -namespace NL\NlMenubuilder\ViewHelpers\Widget; - -use NL\NlMenubuilder\ViewHelpers\Widget\Controller\ShowController; -use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper; - -class ShowViewHelper extends AbstractWidgetViewHelper -{ - /** - * @var ShowController - */ - protected $controller; - - /** - * Inject controller - * - * @param ShowController $controller - */ - public function injectController(ShowController $controller) - { - $this->controller = $controller; - } - - /** - * Initialize arguments - * - * @return void - */ - public function initializeArguments() - { - $this->registerArgument('uuid', 'int', 'UUID of the menu', true, 0); - } - - /** - * Render everything - * - * @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface $objects - * @param int $uuid - * @param string $as - * @return string - */ - public function render() - { - return $this->initiateSubRequest(); - } -} diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php new file mode 100644 index 0000000000000000000000000000000000000000..10f7bf41a0e7ed2c34b2e3c21788280b3bd09e51 --- /dev/null +++ b/Configuration/Extbase/Persistence/Classes.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types = 1); + +return [ + \NL\NlMenubuilder\Domain\Model\Page::class => [ + 'tableName' => 'pages', + ], + \NL\NlMenubuilder\Domain\Model\MenuItem::class => [ + 'tableName' => 'tx_nlmenubuilder_domain_model_menuitem', + 'subclasses' => [ + \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_PAGE => \NL\NlMenubuilder\Domain\Model\MenuItemPage::class, + \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_CONTENT => \NL\NlMenubuilder\Domain\Model\MenuItemContent::class, + \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_LINK => \NL\NlMenubuilder\Domain\Model\MenuItemLink::class, + \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_SUBMENU => \NL\NlMenubuilder\Domain\Model\MenuItemSubmenu::class, + ] + ], + \NL\NlMenubuilder\Domain\Model\MenuItemPage::class => [ + 'tableName' => 'tx_nlmenubuilder_domain_model_menuitem', + 'recordType' => \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_PAGE + ], + \NL\NlMenubuilder\Domain\Model\MenuItemContent::class => [ + 'tableName' => 'tx_nlmenubuilder_domain_model_menuitem', + 'recordType' => \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_CONTENT + ], + \NL\NlMenubuilder\Domain\Model\MenuItemLink::class => [ + 'tableName' => 'tx_nlmenubuilder_domain_model_menuitem', + 'recordType' => \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_LINK + ], + \NL\NlMenubuilder\Domain\Model\MenuItemSubmenu::class => [ + 'tableName' => 'tx_nlmenubuilder_domain_model_menuitem', + 'recordType' => \NL\NlMenubuilder\Domain\Model\MenuItem::TYPE_SUBMENU + ], +]; diff --git a/Configuration/TCA/tx_nlmenubuilder_domain_model_menu.php b/Configuration/TCA/tx_nlmenubuilder_domain_model_menu.php index 2d0d3d195b52b6b654e42827329eb94ccc9b1bb0..1a2d499dc85f0cfcc855191aa60e356662715aa4 100644 --- a/Configuration/TCA/tx_nlmenubuilder_domain_model_menu.php +++ b/Configuration/TCA/tx_nlmenubuilder_domain_model_menu.php @@ -16,17 +16,15 @@ return [ 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', - 'starttime' => 'starttime', - 'endtime' => 'endtime', ], - 'searchFields' => 'title', + 'searchFields' => 'title,template', 'iconfile' => 'EXT:nl_menubuilder/Resources/Public/Icons/tx_nlmenubuilder_domain_model_menu.gif' ], 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, menu_group, menu_item', + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, template, items', ], 'types' => [ - '1' => ['showitem' => "menu_group, title, --div--;$ll:menu.tabs.menu_item, menu_item, --div--;$ll:tabs.access, starttime, endtime, sys_language_uid, l10n_parent, l10n_diffsource, hidden"], + '1' => ['showitem' => "title, template, --div--;$ll:menu.tabs.menu_item, items, --div--;$ll:tabs.access, starttime, endtime, sys_language_uid, l10n_parent, l10n_diffsource, hidden"], ], 'columns' => [ 'sys_language_uid' => [ @@ -44,7 +42,8 @@ return [ ] ], 'default' => 0, - ],], + ], + ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', 'exclude' => true, @@ -88,35 +87,6 @@ return [ ], ], ], - 'starttime' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - ], - 'endtime' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038) - ], - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - ], 'title' => [ 'exclude' => false, @@ -127,39 +97,36 @@ return [ 'eval' => 'trim,required' ], ], - 'menu_group' => [ + 'template' => [ 'exclude' => false, - 'label' => "$ll:tx_nlmenubuilder_domain_model_menu.menu_group", + 'label' => "$ll:tx_nlmenubuilder_domain_model_menu.template", 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', - 'foreign_table' => 'tx_nlmenubuilder_domain_model_menugroup', - 'default' => 0, - 'minitems' => 0, - 'maxitems' => 1, - 'eval' => 'required' + 'items' => [], + 'itemsProcFunc' => 'NL\NlMenubuilder\Hooks\ItemsProcFunc->loadMenuGroupTemplates' ], ], - 'menu_item' => [ - 'exclude' => true, - 'label' => "$ll:tx_nlmenubuilder_domain_model_menu.menu_item", + 'items' => [ + 'exclude' => false, + 'label' => "$ll:tx_nlmenubuilder_domain_model_menu.items", 'config' => [ 'type' => 'inline', - 'allowed' => 'menuitem', 'foreign_table' => 'tx_nlmenubuilder_domain_model_menuitem', + 'foreign_field' => 'menuitem', 'foreign_sortby' => 'sorting', - 'foreign_field' => 'menu', - 'minitems' => 0, + 'minitems' => 1, 'maxitems' => 99, 'appearance' => [ 'collapseAll' => true, 'expandSingle' => true, 'levelLinksPosition' => 'bottom', 'useSortable' => true, - 'showSynchronizationLink' => 1, - 'showPossibleLocalizationRecords' => 1, - 'showAllLocalizationLink' => 1, + 'showPossibleLocalizationRecords' => true, + 'showRemovedLocalizationRecords' => true, + 'showAllLocalizationLink' => true, + 'showSynchronizationLink' => true, 'enabledControls' => [ 'info' => false, ] @@ -168,10 +135,5 @@ return [ ], - 'menuitem' => [ - 'config' => [ - 'type' => 'passthrough', - ], - ], ], ]; diff --git a/Configuration/TCA/tx_nlmenubuilder_domain_model_menugroup.php b/Configuration/TCA/tx_nlmenubuilder_domain_model_menugroup.php deleted file mode 100644 index 016fdadf310218bf04f9bebde0014a35dc6ab497..0000000000000000000000000000000000000000 --- a/Configuration/TCA/tx_nlmenubuilder_domain_model_menugroup.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php - -$ll = 'LLL:EXT:nl_menubuilder/Resources/Private/Language/locallang_db.xlf'; - -return [ - 'ctrl' => [ - 'title' => "$ll:tx_nlmenubuilder_domain_model_menugroup", - 'label' => 'title', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', - 'versioningWS' => true, - 'languageField' => 'sys_language_uid', - 'transOrigPointerField' => 'l10n_parent', - 'transOrigDiffSourceField' => 'l10n_diffsource', - 'delete' => 'deleted', - 'enablecolumns' => [ - 'disabled' => 'hidden', - 'starttime' => 'starttime', - 'endtime' => 'endtime', - ], - 'searchFields' => 'title', - 'iconfile' => 'EXT:nl_menubuilder/Resources/Public/Icons/tx_nlmenubuilder_domain_model_menugroup.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, template', - ], - 'types' => [ - '1' => ['showitem' => "title, template, --div--;$ll:tabs.access, starttime, endtime, sys_language_uid, l10n_parent, l10n_diffsource, hidden"], - ], - 'columns' => [ - 'sys_language_uid' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'special' => 'languages', - 'items' => [ - [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', - -1, - 'flags-multiple' - ] - ], - 'default' => 0, - ], - ], - 'l10n_parent' => [ - 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'default' => 0, - 'items' => [ - ['', 0], - ], - 'foreign_table' => 'tx_nlmenubuilder_domain_model_menugroup', - 'foreign_table_where' => 'AND {#tx_nlmenubuilder_domain_model_menugroup}.{#pid}=###CURRENT_PID### AND {#tx_nlmenubuilder_domain_model_menugroup}.{#sys_language_uid} IN (-1,0)', - ], - ], - 'l10n_diffsource' => [ - 'config' => [ - 'type' => 'passthrough', - ], - ], - 't3ver_label' => [ - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', - 'config' => [ - 'type' => 'input', - 'size' => 30, - 'max' => 255, - ], - ], - 'hidden' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', - 'config' => [ - 'type' => 'check', - 'renderType' => 'checkboxToggle', - 'items' => [ - [ - 0 => '', - 1 => '', - 'invertStateDisplay' => true - ] - ], - ], - ], - 'starttime' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - ], - 'endtime' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038) - ], - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - ], - - 'title' => [ - 'exclude' => false, - 'label' => "$ll:tx_nlmenubuilder_domain_model_menugroup.title", - 'config' => [ - 'type' => 'input', - 'size' => 30, - 'eval' => 'trim,required' - ], - ], - - 'template' => [ - 'exclude' => false, - 'label' => "$ll:tx_nlmenubuilder_domain_model_menugroup.template", - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['-', ''] - ], - 'itemsProcFunc' => 'NL\NlMenubuilder\Hooks\ItemsProcFunc->loadMenuGroupTemplates' - ], - ], - - ], -]; diff --git a/Configuration/TCA/tx_nlmenubuilder_domain_model_menuitem.php b/Configuration/TCA/tx_nlmenubuilder_domain_model_menuitem.php index e53876000374edc358637c89a7f56fb19bb33f6e..08384b170aff3fab584ccb5b705d301b1304c14d 100644 --- a/Configuration/TCA/tx_nlmenubuilder_domain_model_menuitem.php +++ b/Configuration/TCA/tx_nlmenubuilder_domain_model_menuitem.php @@ -17,26 +17,37 @@ return [ 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', - 'starttime' => 'starttime', - 'endtime' => 'endtime', ], - 'searchFields' => 'title,subtitle,page,link,content', + 'searchFields' => 'title,subtitle,link,content', 'iconfile' => 'EXT:nl_menubuilder/Resources/Public/Icons/tx_nlmenubuilder_domain_model_menuitem.gif', 'type' => 'type', 'typeicon_column' => 'type', 'typeicon_classes' => [ 'default' => 'ext-menubuilder-menuitem-type-page', + '0' => 'ext-menubuilder-menuitem-type-page', '1' => 'ext-menubuilder-menuitem-type-link', '2' => 'ext-menubuilder-menuitem-type-content', '3' => 'ext-menubuilder-menuitem-type-submenu', ], + 'hideTable' => 1, + ], + 'interface' => [ + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, type, title, subtitle, image, link, content, items, page', ], - 'interface' => ['showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, type, title, subtitle, image, page, link, content'], 'types' => [ - '0' => ['showitem' => "type, title, subtitle, page, image, $accessTab"], // page - '1' => ['showitem' => "type, title, subtitle, image, link, $accessTab"], // link + '0' => [ + 'showitem' => "type, title, page, subtitle, image, $accessTab", + 'columnsOverrides' => [ + 'title' => [ + 'config' => [ + 'eval' => 'trim', + ], + ], + ], + ], // page + '1' => ['showitem' => "type, title, link, subtitle, image, $accessTab"], // link '2' => ['showitem' => "type, title, content, $accessTab"], // content - '3' => ['showitem' => "type, title, submenu, $accessTab"], // submenu + '3' => ['showitem' => "type, title, items, $accessTab"], // submenu ], 'columns' => [ 'sys_language_uid' => [ @@ -99,35 +110,7 @@ return [ ], ], ], - 'starttime' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - ], - 'endtime' => [ - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038) - ], - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - ], + 'type' => [ 'exclude' => false, 'label' => "$ll:tx_nlmenubuilder_domain_model_menuitem.type", @@ -220,25 +203,6 @@ return [ ), ], - 'page' => [ - 'exclude' => false, - 'label' => "$ll:tx_nlmenubuilder_domain_model_menuitem.page", - 'config' => [ - 'type' => 'group', - 'internal_type' => 'db', - 'allowed' => 'pages', - 'maxitems' => 1, - 'minitems' => 1, - 'size' => 1, - 'default' => 0, - 'suggestOptions' => [ - 'default' => [ - 'additionalSearchFields' => 'nav_title, alias, url', - 'addWhere' => 'AND pages.doktype IN (1, 3, 4)' - ] - ] - ], - ], 'link' => [ 'exclude' => false, 'label' => "$ll:tx_nlmenubuilder_domain_model_menuitem.link", @@ -280,32 +244,49 @@ return [ ] ], ], - ], - 'submenu' => [ - 'exclude' => true, - 'label' => "$ll:tx_nlmenubuilder_domain_model_menuitem.submenu", + 'items' => [ + 'exclude' => false, + 'label' => "$ll:tx_nlmenubuilder_domain_model_menuitem.items", 'config' => [ - 'type' => 'select', - 'renderType' => 'selectMultipleSideBySide', - 'foreign_table' => 'tx_nlmenubuilder_domain_model_menu', - 'size' => 10, - 'autoSizeMax' => 30, - 'maxitems' => 1, + 'type' => 'inline', + 'foreign_table' => 'tx_nlmenubuilder_domain_model_menuitem', + 'foreign_field' => 'menuitem', + 'foreign_sortby' => 'sorting', 'minitems' => 1, - 'multiple' => 0, - 'fieldControl' => [ - 'editPopup' => [ - 'disabled' => false, - ], - 'addRecord' => [ - 'disabled' => false, - ], - 'listModule' => [ - 'disabled' => true, - ], + 'maxitems' => 99, + 'appearance' => [ + 'collapseAll' => true, + 'expandSingle' => true, + 'levelLinksPosition' => 'bottom', + 'useSortable' => true, + 'showPossibleLocalizationRecords' => true, + 'showRemovedLocalizationRecords' => true, + 'showAllLocalizationLink' => true, + 'showSynchronizationLink' => true, + 'enabledControls' => [ + 'info' => false, + ] ], - 'enableMultiSelectFilterTextfield' => true, + ], + ], + 'page' => [ + 'exclude' => false, + 'label' => "$ll:tx_nlmenubuilder_domain_model_menuitem.page", + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'pages', + 'maxitems' => 1, + 'minitems' => 1, + 'size' => 1, + 'default' => 0, + 'suggestOptions' => [ + 'default' => [ + 'additionalSearchFields' => 'nav_title, alias, url', + 'addWhere' => 'AND pages.doktype IN (1, 3, 4)' + ] + ] ], ], @@ -315,5 +296,10 @@ return [ 'type' => 'passthrough', ], ], + 'menuitem' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], ], ]; diff --git a/ExtensionBuilder.json b/ExtensionBuilder.json index a3b783cfbd824cdba8dc2e23e75ce144565bb821..de7b5e45bc0ffabf405a489dc4cd478fe2dc1ef9 100644 --- a/ExtensionBuilder.json +++ b/ExtensionBuilder.json @@ -3,8 +3,8 @@ { "config": { "position": [ - 982, - 274 + 339, + 152 ] }, "name": "New Model Object", @@ -21,7 +21,7 @@ "objectsettings": { "addDeletedField": true, "addHiddenField": true, - "addStarttimeEndtimeFields": true, + "addStarttimeEndtimeFields": false, "aggregateRoot": true, "categorizable": false, "description": "", @@ -43,6 +43,17 @@ "propertyName": "title", "propertyType": "String", "uid": "1605171702573" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": false, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": true, + "propertyName": "template", + "propertyType": "String", + "uid": "1234520526980" } ] }, @@ -53,18 +64,7 @@ "lazyLoading": false, "propertyIsExcludeField": false, "relationDescription": "", - "relationName": "menuGroup", - "relationType": "manyToOne", - "relationWire": "[wired]", - "renderType": "selectSingle", - "uid": "910633819500" - }, - { - "foreignRelationClass": "", - "lazyLoading": false, - "propertyIsExcludeField": false, - "relationDescription": "", - "relationName": "menuItem", + "relationName": "items", "relationType": "zeroToMany", "relationWire": "[wired]", "renderType": "inline", @@ -77,59 +77,8 @@ { "config": { "position": [ - 1258, - 14 - ] - }, - "name": "New Model Object", - "value": { - "actionGroup": { - "_default0_list": false, - "_default1_show": false, - "_default2_new_create": false, - "_default3_edit_update": false, - "_default4_delete": false, - "customActions": [] - }, - "name": "MenuGroup", - "objectsettings": { - "addDeletedField": true, - "addHiddenField": true, - "addStarttimeEndtimeFields": true, - "aggregateRoot": true, - "categorizable": false, - "description": "", - "mapToTable": "", - "parentClass": "", - "sorting": false, - "type": "Entity", - "uid": "908718443858" - }, - "propertyGroup": { - "properties": [ - { - "allowedFileTypes": "", - "maxItems": "1", - "propertyDescription": "Name of the menu group", - "propertyIsExcludeField": false, - "propertyIsL10nModeExclude": false, - "propertyIsRequired": false, - "propertyName": "title", - "propertyType": "String", - "uid": "1499991436488" - } - ] - }, - "relationGroup": { - "relations": [] - } - } - }, - { - "config": { - "position": [ - 471, - 365 + 337, + 384 ] }, "name": "New Model Object", @@ -146,8 +95,8 @@ "objectsettings": { "addDeletedField": true, "addHiddenField": true, - "addStarttimeEndtimeFields": true, - "aggregateRoot": true, + "addStarttimeEndtimeFields": false, + "aggregateRoot": false, "categorizable": false, "description": "", "mapToTable": "", @@ -175,7 +124,7 @@ "propertyDescription": "Name of the menu item", "propertyIsExcludeField": false, "propertyIsL10nModeExclude": false, - "propertyIsRequired": true, + "propertyIsRequired": false, "propertyName": "title", "propertyType": "String", "uid": "1275033111048" @@ -202,17 +151,6 @@ "propertyType": "Image", "uid": "232675499137" }, - { - "allowedFileTypes": "", - "maxItems": "1", - "propertyDescription": "", - "propertyIsExcludeField": false, - "propertyIsL10nModeExclude": false, - "propertyIsRequired": false, - "propertyName": "page", - "propertyType": "String", - "uid": "1319275530787" - }, { "allowedFileTypes": "", "maxItems": "1", @@ -232,7 +170,7 @@ "propertyIsL10nModeExclude": false, "propertyIsRequired": false, "propertyName": "content", - "propertyType": "RichText", + "propertyType": "String", "uid": "1242707690455" } ] @@ -242,15 +180,99 @@ { "foreignRelationClass": "", "lazyLoading": false, - "propertyIsExcludeField": true, + "propertyIsExcludeField": false, "relationDescription": "", - "relationName": "submenu", + "relationName": "items", "relationType": "zeroToMany", "relationWire": "[wired]", "renderType": "inline", - "uid": "1611042414700" + "uid": "16209433090" + }, + { + "foreignRelationClass": "", + "lazyLoading": false, + "propertyIsExcludeField": false, + "relationDescription": "", + "relationName": "page", + "relationType": "zeroToOne", + "relationWire": "[wired]", + "renderType": "inline", + "uid": "148645428661" + } + ] + } + } + }, + { + "config": { + "position": [ + 40, + 407 + ] + }, + "name": "New Model Object", + "value": { + "actionGroup": { + "_default0_list": false, + "_default1_show": false, + "_default2_new_create": false, + "_default3_edit_update": false, + "_default4_delete": false, + "customActions": [] + }, + "name": "Page", + "objectsettings": { + "addDeletedField": false, + "addHiddenField": false, + "addStarttimeEndtimeFields": false, + "aggregateRoot": false, + "categorizable": false, + "description": "", + "mapToTable": "", + "parentClass": "", + "sorting": false, + "type": "Entity", + "uid": "1421122549998" + }, + "propertyGroup": { + "properties": [ + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": false, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "title", + "propertyType": "String", + "uid": "927540777152" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": false, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "navTitle", + "propertyType": "String", + "uid": "880413159436" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": false, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "subtitle", + "propertyType": "String", + "uid": "68317247955" } ] + }, + "relationGroup": { + "relations": [] } } } @@ -267,7 +289,7 @@ "skipGenerateDocumentationTemplate": false, "sourceLanguage": "en", "state": "alpha", - "targetVersion": "9.5.0-9.5.99", + "targetVersion": "10.4.0-10.4.99", "version": "1.0.0" }, "extensionKey": "nl_menubuilder", @@ -282,44 +304,44 @@ { "src": { "moduleId": 0, - "terminal": "relationWire_1", + "terminal": "relationWire_0", "uid": "498399672732" }, "tgt": { - "moduleId": 2, + "moduleId": 1, "terminal": "SOURCES", "uid": "461753844786" } }, { "src": { - "moduleId": 0, + "moduleId": 1, "terminal": "relationWire_0", - "uid": "910633819500" + "uid": "16209433090" }, "tgt": { "moduleId": 1, "terminal": "SOURCES", - "uid": "908718443858" + "uid": "461753844786" } }, { "src": { - "moduleId": 2, - "terminal": "relationWire_0", - "uid": "1611042414700" + "moduleId": 1, + "terminal": "relationWire_1", + "uid": "148645428661" }, "tgt": { - "moduleId": 0, + "moduleId": 2, "terminal": "SOURCES", - "uid": "782096674115" + "uid": "1421122549998" } } ], "storagePath": "\/var\/www\/html\/public\/typo3conf\/ext\/", "log": { - "last_modified": "2021-04-23 09:51", - "extension_builder_version": "9.10.3", - "be_user": " (1)" + "last_modified": "2021-05-05 01:13", + "extension_builder_version": "9.11.0", + "be_user": " (4)" } } \ No newline at end of file diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index ce843a2e8318306f7e767ceae8c1f9ead8eaed4d..d422e4945273c1a8ee3b84b97c1f62e141ded4d3 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang" date="2021-04-23T09:51:09Z" product-name="nl_menubuilder"> + <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang" date="2021-05-05T13:13:18Z" product-name="nl_menubuilder"> <header/> <body> <trans-unit id="tx_nlmenubuilder_domain_model_menu" resname="tx_nlmenubuilder_domain_model_menu"> @@ -9,21 +9,12 @@ <trans-unit id="tx_nlmenubuilder_domain_model_menu.title" resname="tx_nlmenubuilder_domain_model_menu.title"> <source>Title</source> </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menu.menu_group" resname="tx_nlmenubuilder_domain_model_menu.menu_group"> - <source>Menu Group</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menu.menu_item" resname="tx_nlmenubuilder_domain_model_menu.menu_item"> - <source>Menu Item</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup" resname="tx_nlmenubuilder_domain_model_menugroup"> - <source>Menu Group</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup.title" resname="tx_nlmenubuilder_domain_model_menugroup.title"> - <source>Title</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup.template" resname="tx_nlmenubuilder_domain_model_menugroup.template"> + <trans-unit id="tx_nlmenubuilder_domain_model_menu.template" resname="tx_nlmenubuilder_domain_model_menu.template"> <source>Template</source> </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_menu.items" resname="tx_nlmenubuilder_domain_model_menu.items"> + <source>Items</source> + </trans-unit> <trans-unit id="tx_nlmenubuilder_domain_model_menuitem" resname="tx_nlmenubuilder_domain_model_menuitem"> <source>Menu Item</source> </trans-unit> @@ -51,6 +42,21 @@ <trans-unit id="tx_nlmenubuilder_domain_model_menuitem.submenu" resname="tx_nlmenubuilder_domain_model_menuitem.submenu"> <source>Submenu</source> </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_menuitem.items" resname="tx_nlmenubuilder_domain_model_menuitem.items"> + <source>Items</source> + </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_page" resname="tx_nlmenubuilder_domain_model_page"> + <source>Page</source> + </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_page.title" resname="tx_nlmenubuilder_domain_model_page.title"> + <source>Title</source> + </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_page.nav_title" resname="tx_nlmenubuilder_domain_model_page.nav_title"> + <source>Nav Title</source> + </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_page.subtitle" resname="tx_nlmenubuilder_domain_model_page.subtitle"> + <source>Subtitle</source> + </trans-unit> </body> </file> </xliff> diff --git a/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menu.xlf b/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menu.xlf index 27093bae9495771a6177760104e4215834210c11..eef14faeee7ffb7ddda92b5f9e730e9ca5cdfd87 100644 --- a/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menu.xlf +++ b/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menu.xlf @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_csh" date="2021-04-23T09:51:09Z" product-name="nl_menubuilder"> + <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_csh" date="2021-05-05T13:13:18Z" product-name="nl_menubuilder"> <header/> <body> <trans-unit id="title.description" resname="title.description"> <source>Name of the menu</source> </trans-unit> - <trans-unit id="menu_group.description" resname="menu_group.description"> - <source>menuGroup</source> + <trans-unit id="template.description" resname="template.description"> + <source>template</source> </trans-unit> - <trans-unit id="menu_item.description" resname="menu_item.description"> - <source>menuItem</source> + <trans-unit id="items.description" resname="items.description"> + <source>items</source> </trans-unit> </body> </file> diff --git a/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menuitem.xlf b/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menuitem.xlf index 121cf9616a24d1c3c11392f9c33e0d686d18fe9f..0ced5ecd77a86e85b3dc078e0f2380b955e041f7 100644 --- a/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menuitem.xlf +++ b/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menuitem.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_csh" date="2021-04-23T09:51:09Z" product-name="nl_menubuilder"> + <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_csh" date="2021-05-05T13:13:18Z" product-name="nl_menubuilder"> <header/> <body> <trans-unit id="type.description" resname="type.description"> @@ -15,17 +15,17 @@ <trans-unit id="image.description" resname="image.description"> <source>Optional link image</source> </trans-unit> - <trans-unit id="page.description" resname="page.description"> - <source>page</source> - </trans-unit> <trans-unit id="link.description" resname="link.description"> <source>link</source> </trans-unit> <trans-unit id="content.description" resname="content.description"> <source>content</source> </trans-unit> - <trans-unit id="submenu.description" resname="submenu.description"> - <source>submenu</source> + <trans-unit id="items.description" resname="items.description"> + <source>items</source> + </trans-unit> + <trans-unit id="page.description" resname="page.description"> + <source>page</source> </trans-unit> </body> </file> diff --git a/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_page.xlf b/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_page.xlf new file mode 100644 index 0000000000000000000000000000000000000000..77e943a0b1751394cd212400e8ef16f17b1a7b62 --- /dev/null +++ b/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_page.xlf @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<xliff version="1.0"> + <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_csh" date="2021-05-05T13:13:18Z" product-name="nl_menubuilder"> + <header/> + <body> + <trans-unit id="title.description" resname="title.description"> + <source>title</source> + </trans-unit> + <trans-unit id="nav_title.description" resname="nav_title.description"> + <source>navTitle</source> + </trans-unit> + <trans-unit id="subtitle.description" resname="subtitle.description"> + <source>subtitle</source> + </trans-unit> + </body> + </file> +</xliff> diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 31a1067110881690b3578b471954f330609d8a7d..09afb8e8633e5bb14073bcc28698af210fb80bf6 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> - <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_db" date="2021-04-23T09:51:09Z" product-name="nl_menubuilder"> + <file source-language="en" datatype="plaintext" original="EXT:nl_menubuilder/Resources/Private/Language/locallang_db" date="2021-05-05T13:13:18Z" product-name="nl_menubuilder"> <header/> <body> <trans-unit id="tx_nlmenubuilder_domain_model_menu" resname="tx_nlmenubuilder_domain_model_menu"> @@ -9,21 +9,12 @@ <trans-unit id="tx_nlmenubuilder_domain_model_menu.title" resname="tx_nlmenubuilder_domain_model_menu.title"> <source>Title</source> </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menu.menu_group" resname="tx_nlmenubuilder_domain_model_menu.menu_group"> - <source>Menu Group</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menu.menu_item" resname="tx_nlmenubuilder_domain_model_menu.menu_item"> - <source>Menu Item</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup" resname="tx_nlmenubuilder_domain_model_menugroup"> - <source>Menu Group</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup.title" resname="tx_nlmenubuilder_domain_model_menugroup.title"> - <source>Title</source> - </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup.template" resname="tx_nlmenubuilder_domain_model_menugroup.template"> + <trans-unit id="tx_nlmenubuilder_domain_model_menu.template" resname="tx_nlmenubuilder_domain_model_menu.template"> <source>Template</source> </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_menu.items" resname="tx_nlmenubuilder_domain_model_menu.items"> + <source>Items</source> + </trans-unit> <trans-unit id="tx_nlmenubuilder_domain_model_menuitem" resname="tx_nlmenubuilder_domain_model_menuitem"> <source>Menu Item</source> </trans-unit> @@ -51,19 +42,24 @@ <trans-unit id="tx_nlmenubuilder_domain_model_menuitem.submenu" resname="tx_nlmenubuilder_domain_model_menuitem.submenu"> <source>Submenu</source> </trans-unit> - <trans-unit id="tabs.access" resname="tabs.access"> - <source>Access</source> + <trans-unit id="tx_nlmenubuilder_domain_model_menuitem.items" resname="tx_nlmenubuilder_domain_model_menuitem.items"> + <source>Items</source> </trans-unit> - <trans-unit id="menu.tabs.menu_item" resname="menu.tabs.menu_item"> - <source>Menu Items</source> + <trans-unit id="tx_nlmenubuilder_domain_model_page" resname="tx_nlmenubuilder_domain_model_page"> + <source>Page</source> + </trans-unit> + <trans-unit id="tx_nlmenubuilder_domain_model_page.title" resname="tx_nlmenubuilder_domain_model_page.title"> + <source>Title</source> </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup.template.I.Index" resname="tx_nlmenubuilder_domain_model_menugroup.template.I.Index"> - <source>Index</source> + <trans-unit id="tx_nlmenubuilder_domain_model_page.nav_title" resname="tx_nlmenubuilder_domain_model_page.nav_title"> + <source>Nav Title</source> </trans-unit> - <trans-unit id="tx_nlmenubuilder_domain_model_menugroup.template.I.Show" resname="tx_nlmenubuilder_domain_model_menugroup.template.I.Show"> - <source>Show</source> + <trans-unit id="tx_nlmenubuilder_domain_model_page.subtitle" resname="tx_nlmenubuilder_domain_model_page.subtitle"> + <source>Subtitle</source> + </trans-unit> + <trans-unit id="menu.tabs.menu_item" resname="menu.tabs.menu_item"> + <source>Menu Items</source> </trans-unit> - </body> </file> </xliff> diff --git a/Resources/Private/Partials/Menu.html b/Resources/Private/Partials/Menu.html index ebd4fd7140783ee22bd33f5be543e318b589d024..21cd47525e18047e3aa1bef3cc66b7c02b4edc8a 100644 --- a/Resources/Private/Partials/Menu.html +++ b/Resources/Private/Partials/Menu.html @@ -1,10 +1,14 @@ +<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> + <div class="menu-builder menu"> <div class="menu-builder menu-title" hidden>{menu.title}</div> <div class="menu-builder menu-item-group"> - <f:for each="{menu.menuItem}" as="menuItem"> + <f:for each="{menu.items}" as="menuItem"> <div class="menu-builder menu-item"> - <f:render partial="MenuItem/{menuItem.typeName}" arguments="{menuItem:menuItem}" /> + <f:render partial="MenuItem/{menuItem.typeName}" arguments="{menuItem: menuItem}" /> </div> </f:for> </div> </div> + +</html> diff --git a/Resources/Private/Partials/MenuItem/Content.html b/Resources/Private/Partials/MenuItem/Content.html index 7da59a8347985ca9bba4f8f3ed2a9eb9d4e624a2..8f62e1b58d2e0851349be24ddc3dfd13915e89a2 100644 --- a/Resources/Private/Partials/MenuItem/Content.html +++ b/Resources/Private/Partials/MenuItem/Content.html @@ -4,3 +4,5 @@ <div class="menu-builder menu-item-title">{menuItem.title}</div> <f:cObject typoscriptObjectPath="lib.tx_nlmenubuilder.contentElementRendering">{menuItem.content}</f:cObject> </div> + +</html> diff --git a/Resources/Private/Partials/MenuItem/Link.html b/Resources/Private/Partials/MenuItem/Link.html index 09fec575ebbcc7cc9b3bba349d9f79810ea12ed6..37786f073ddc13122cdd3ed7cae5d16a2c1a8457 100644 --- a/Resources/Private/Partials/MenuItem/Link.html +++ b/Resources/Private/Partials/MenuItem/Link.html @@ -3,3 +3,5 @@ <div class="menu-builder menu-item-link"> <f:link.typolink parameter="{menuItem.link}">{menuItem.title}</f:link.typolink> </div> + +</html> diff --git a/Resources/Private/Partials/MenuItem/Page.html b/Resources/Private/Partials/MenuItem/Page.html index 8015bb3b80386ad3dc43dcdcf28e00d248d19312..f19ac9444314af5ee8da5997b60633863894335a 100644 --- a/Resources/Private/Partials/MenuItem/Page.html +++ b/Resources/Private/Partials/MenuItem/Page.html @@ -1,5 +1,7 @@ <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> <div class="menu-builder menu-item-page"> - <f:link.page pageUid="{menuItem.page}">{menuItem.title}</f:link.page> + <f:link.page pageUid="{menuItem.page.uid}">{menuItem.title}</f:link.page> </div> + +</html> diff --git a/Resources/Private/Partials/MenuItem/Submenu.html b/Resources/Private/Partials/MenuItem/Submenu.html index 462732b729df453b44477a2b412cc85c79f5c589..a86e17e16c33c847b627b7d6d1cd45e35568be63 100644 --- a/Resources/Private/Partials/MenuItem/Submenu.html +++ b/Resources/Private/Partials/MenuItem/Submenu.html @@ -2,6 +2,7 @@ <div class="menu-builder menu-item-submenu"> <div class="menu-builder menu-item-title">{menuItem.title}</div> - - <f:render partial="Menu" arguments="{menu:menuItem.submenu}" /> + <f:render partial="Menu" arguments="{menu: menuItem}" /> </div> + +</html> diff --git a/Resources/Private/Templates/ViewHelpers/Menu/Render/Index.html b/Resources/Private/Templates/ViewHelpers/Menu/Render/Index.html new file mode 100644 index 0000000000000000000000000000000000000000..cf6847e3aafca09988d96f0532b3616c18021314 --- /dev/null +++ b/Resources/Private/Templates/ViewHelpers/Menu/Render/Index.html @@ -0,0 +1,10 @@ +<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> + +<div class="menu-builder menu"> + <div>[DEV]Index Template[DEV]</div> + <div class="menu-builder menu-title" hidden>{menu.title}</div> + + <f:render partial="Menu" arguments="{menu: menu}" /> +</div> + +</html> diff --git a/Resources/Private/Templates/ViewHelpers/Widget/Show/Index.html b/Resources/Private/Templates/ViewHelpers/Widget/Show/Index.html deleted file mode 100644 index 82456c67b305edf0ccc292a35ee1c6f73fc3ec23..0000000000000000000000000000000000000000 --- a/Resources/Private/Templates/ViewHelpers/Widget/Show/Index.html +++ /dev/null @@ -1,9 +0,0 @@ -<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> - -<div class="menu-builder menu-group"> - <div>[DEV]Index Template[DEV]</div> - <div class="menu-builder menu-group-title" hidden>{menu.menuGroup.title}</div> - - <f:render partial="Menu" arguments="{menu:menu}" /> - -</div> diff --git a/Resources/Private/Templates/ViewHelpers/Widget/Show/Show.html b/Resources/Private/Templates/ViewHelpers/Widget/Show/Show.html deleted file mode 100644 index fc5006d8324f1446a837bb55349c84b8a25fe963..0000000000000000000000000000000000000000 --- a/Resources/Private/Templates/ViewHelpers/Widget/Show/Show.html +++ /dev/null @@ -1,9 +0,0 @@ -<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> - -<div class="menu-builder menu-group"> - <div>[DEV]Show Template[DEV]</div> - <div class="menu-builder menu-group-title" hidden>{menu.menuGroup.title}</div> - - <f:render partial="Menu" arguments="{menu:menu}" /> - -</div> diff --git a/Resources/Public/Icons/tx_nlmenubuilder_domain_model_menugroup.gif b/Resources/Public/Icons/tx_nlmenubuilder_domain_model_menugroup.gif deleted file mode 100644 index 4013d7a6ea57d909a3d8d073195b548f09256155..0000000000000000000000000000000000000000 Binary files a/Resources/Public/Icons/tx_nlmenubuilder_domain_model_menugroup.gif and /dev/null differ diff --git a/Resources/Public/Icons/tx_nlmenubuilder_domain_model_page.gif b/Resources/Public/Icons/tx_nlmenubuilder_domain_model_page.gif new file mode 100644 index 0000000000000000000000000000000000000000..37ba37b9b3a220018e3a291bf2ee413d0da30ce0 Binary files /dev/null and b/Resources/Public/Icons/tx_nlmenubuilder_domain_model_page.gif differ diff --git a/ext_emconf.php b/ext_emconf.php index e73235135a0605adea4aadf188b2712348fa181c..902effd1dc8d48f6ae84c6a0d2e5ff2dcf549270 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -3,7 +3,7 @@ /*************************************************************** * Extension Manager/Repository config file for ext: "nl_menubuilder" * - * Auto generated by Extension Builder 2021-04-23 + * Auto generated by Extension Builder 2021-05-05 * * Manual updates: * Only the data in the array - anything else is removed by next write. diff --git a/ext_tables.php b/ext_tables.php index 41d074abe233c85fceb1d56f99ce0edf35982e26..a3d04b5d5de1aae32ef0a180a8aed0470889ce42 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -10,11 +10,11 @@ call_user_func( \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_nlmenubuilder_domain_model_menu', 'EXT:nl_menubuilder/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menu.xlf'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_nlmenubuilder_domain_model_menu'); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_nlmenubuilder_domain_model_menugroup', 'EXT:nl_menubuilder/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menugroup.xlf'); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_nlmenubuilder_domain_model_menugroup'); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_nlmenubuilder_domain_model_menuitem', 'EXT:nl_menubuilder/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_menuitem.xlf'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_nlmenubuilder_domain_model_menuitem'); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_nlmenubuilder_domain_model_page', 'EXT:nl_menubuilder/Resources/Private/Language/locallang_csh_tx_nlmenubuilder_domain_model_page.xlf'); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_nlmenubuilder_domain_model_page'); + } ); diff --git a/ext_tables.sql b/ext_tables.sql index 93728679a6108613cd571c0784359ec437ce8192..ccd7f9823de4ba70cd02da1b7de11701d2034693 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -1,41 +1,23 @@ -# -# Table structure for table 'tx_nlmenubuilder_domain_model_menu' -# CREATE TABLE tx_nlmenubuilder_domain_model_menu ( - menuitem int(11) unsigned DEFAULT '0' NOT NULL, - - title varchar(255) DEFAULT '' NOT NULL, - menu_group int(11) unsigned DEFAULT '0', - menu_item int(11) unsigned DEFAULT '0' NOT NULL - -); - -# -# Table structure for table 'tx_nlmenubuilder_domain_model_menugroup' -# -CREATE TABLE tx_nlmenubuilder_domain_model_menugroup ( - title varchar(255) DEFAULT '' NOT NULL, - template varchar(255) DEFAULT '' NOT NULL + template varchar(255) DEFAULT '' NOT NULL, + items int(11) unsigned DEFAULT '0' NOT NULL ); -# -# Table structure for table 'tx_nlmenubuilder_domain_model_menuitem' -# CREATE TABLE tx_nlmenubuilder_domain_model_menuitem ( menu int(11) unsigned DEFAULT '0' NOT NULL, + menuitem int(11) unsigned DEFAULT '0' NOT NULL, - sorting int(11) NOT NULL DEFAULT '0', type int(11) DEFAULT '0' NOT NULL, title varchar(255) DEFAULT '' NOT NULL, subtitle varchar(255) DEFAULT '' NOT NULL, image int(11) unsigned NOT NULL default '0', - page varchar(255) DEFAULT '' NOT NULL, link varchar(255) DEFAULT '' NOT NULL, content varchar(255) DEFAULT '' NOT NULL, - submenu int(11) unsigned DEFAULT '0' NOT NULL + items int(11) unsigned DEFAULT '0' NOT NULL, + page int(11) unsigned DEFAULT '0' );