diff --git a/Classes/Domain/Model/Dto/EmConfiguration.php b/Classes/Domain/Model/Dto/EmConfiguration.php index 5f8e877a9f..398fee4cbd 100644 --- a/Classes/Domain/Model/Dto/EmConfiguration.php +++ b/Classes/Domain/Model/Dto/EmConfiguration.php @@ -84,6 +84,9 @@ public function __construct(array $configuration = []) /** @var string */ protected $slugBehaviour = 'unique'; + /** @var bool */ + protected $pageTreePluginPreview = true; + public function getTagPid(): int { return (int)$this->tagPid; @@ -168,4 +171,10 @@ public function getSlugBehaviour(): string { return $this->slugBehaviour; } + + public function getPageTreePluginPreview(): bool + { + return (bool)$this->pageTreePluginPreview; + } + } diff --git a/Classes/Event/Listener/ModifyPageTreeItems.php b/Classes/Event/Listener/ModifyPageTreeItems.php index 317ee44fa1..b4077bc58c 100644 --- a/Classes/Event/Listener/ModifyPageTreeItems.php +++ b/Classes/Event/Listener/ModifyPageTreeItems.php @@ -11,6 +11,7 @@ namespace GeorgRinger\News\Event\Listener; +use GeorgRinger\News\Domain\Model\Dto\EmConfiguration; use TYPO3\CMS\Backend\Controller\Event\AfterPageTreeItemsPreparedEvent; use TYPO3\CMS\Backend\Dto\Tree\Status\StatusInformation; use TYPO3\CMS\Core\Attribute\AsEventListener; @@ -25,6 +26,7 @@ )] final class ModifyPageTreeItems { + private EmConfiguration $emConfiguration; private const NEWS_TYPES = [ 'news_pi1' => 'ext-news-plugin-news-list', 'news_newsliststicky' => 'ext-news-plugin-news-list-sticky', @@ -37,8 +39,16 @@ final class ModifyPageTreeItems 'news_taglist' => 'ext-news-plugin-tag-list', ]; + public function __construct() + { + $this->emConfiguration = GeneralUtility::makeInstance(EmConfiguration::class); + } + public function __invoke(AfterPageTreeItemsPreparedEvent $event): void { + if (!$this->emConfiguration->getPageTreePluginPreview()) { + return; + } $items = $event->getItems(); foreach ($items as &$item) { $ctype = $this->getFirstFoundNewsType($item['_page']['uid']); diff --git a/Documentation/Reference/ExtensionConfiguration/Index.rst b/Documentation/Reference/ExtensionConfiguration/Index.rst index db0ccece74..f915d45271 100644 --- a/Documentation/Reference/ExtensionConfiguration/Index.rst +++ b/Documentation/Reference/ExtensionConfiguration/Index.rst @@ -212,6 +212,20 @@ Slug behaviour `slugBehaviour` unique The same news title in different sites will lead to different slug names. +.. _extensionConfigurationPageTreePluginPreview: + +Page Tree Plugin Preview +------------------------ + +.. confval:: pageTreePluginPreview + + :type: bool + :Default: 1 + + If set, pages which contain a news plugin will show an additional icon right to the title in the page tree. This makes it easier to identify pages which are related to EXT:news. + + This setting is only relevant since TYPO3 13! + Backend Module ============== diff --git a/Resources/Private/Language/locallang_be.xlf b/Resources/Private/Language/locallang_be.xlf index 2352208fc2..6711edb228 100644 --- a/Resources/Private/Language/locallang_be.xlf +++ b/Resources/Private/Language/locallang_be.xlf @@ -371,6 +371,9 @@ Slug behaviour: uniqueInSite: The same slug can be used for news in different sites. Use this setting *only* if no news records are shared between sites. "unique" means that same news title will lead to different slug names. + + Plugin preview in page tree: If enabled pages with news plugins are highlighted by showing the plugin icon as status information [TYPO3 13 only] + Use this overlay for news categories in the Backend diff --git a/ext_conf_template.txt b/ext_conf_template.txt index 0cd9775ee2..5b5f6d38f6 100644 --- a/ext_conf_template.txt +++ b/ext_conf_template.txt @@ -33,6 +33,9 @@ advancedMediaPreview = 1 # cat=records/enable/155; type=options[unique=unique,uniqueInSite=uniqueInSite,uniqueInPid=uniqueInPid]; label=LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:extmng.slugBehaviour slugBehaviour = unique +# cat=records/enable/300; type=boolean; label=LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:extmng.pageTreePluginPreview +pageTreePluginPreview = 1 + # Backend module # cat=backend module/enable/10; type=boolean; label=LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:extmng.showAdministrationModule