diff --git a/Classes/Hook/ContentPostProcHook.php b/Classes/Hook/ContentPostProcHook.php index fb96a4a..ee1fd24 100644 --- a/Classes/Hook/ContentPostProcHook.php +++ b/Classes/Hook/ContentPostProcHook.php @@ -78,6 +78,10 @@ protected function parseHtml(TypoScriptFrontendController $typoScriptFrontendCon $isDisableParser = true; } + if ((bool) $typoScriptFrontendController->page['tx_dpnglossary_disable_parser'] === true) { + $isDisableParser = true; + } + if (false === $isDisableParser) { $parsedHTML = $this->parserService->pageParser($typoScriptFrontendController->content); diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php new file mode 100644 index 0000000..e0c08a5 --- /dev/null +++ b/Configuration/TCA/Overrides/pages.php @@ -0,0 +1,32 @@ + [ + 'label' => 'LLL:EXT:dpn_glossary/Resources/Private/Language/locallang.xlf:pages.glossary_settings', + 'exclude' => true, + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => 'LLL:EXT:dpn_glossary/Resources/Private/Language/locallang.xlf:pages.parse_for_glossary', + 1 => '', + 'labelChecked' => 'Enabled', + 'labelUnchecked' => 'Disabled', + 'invertStateDisplay' => true, + ], + ], + ], + ], + ]); + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'pages', + 'tx_dpnglossary_disable_parser', + '', + 'after:php_tree_stop' + ); +}); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 49305f1..b8e0fec 100755 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -27,5 +27,33 @@ function () { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($plugin, 'FILE:EXT:dpn_glossary' . $flexform); } + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', [ + 'tx_dpnglossary_disable_parser' => [ + 'label' => 'LLL:EXT:dpn_glossary/Resources/Private/Language/locallang.xlf:tt_content.glossary_settings', + 'exclude' => true, + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => 'LLL:EXT:dpn_glossary/Resources/Private/Language/locallang.xlf:tt_content.parse_for_glossary', + 1 => '', + 'labelChecked' => 'Enabled', + 'labelUnchecked' => 'Disabled', + 'invertStateDisplay' => true, + ], + ], + ], + ], + ]); + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'tt_content', + 'tx_dpnglossary_disable_parser', + '', + 'after:linkToTop' + ); + } ); diff --git a/Configuration/TypoScript/constants.txt b/Configuration/TypoScript/constants.txt index 474cbc1..007d648 100755 --- a/Configuration/TypoScript/constants.txt +++ b/Configuration/TypoScript/constants.txt @@ -34,7 +34,7 @@ plugin.tx_dpnglossary { # cat=dpn_glossary/settings/a; type=string; label=Classes which are not allowed for the parsing tag forbiddenParsingTagClasses = # cat=dpn_glossary/settings/a; type=string; label=Classes which are not allowed on any parent of the parsing tag - forbiddenParentClasses = + forbiddenParentClasses = tx_dpn_glossary_exclude # cat=dpn_glossary/settings/a; type=options[normal,character,pagination]; label=Listmode: normal, character or paginated by characters listmode = normal # cat=dpn_glossary/settings/a; type=options[newest,random]; label=Previewmode: newest or random @@ -51,5 +51,7 @@ plugin.tx_dpnglossary { useTermForSynonymParsingDataWrap = 0 # cat=dpn_glossary/settings/a; type=boolean; label=Add the extension stylesheet (default: enabled) addStylesheet = 1 + # cat=dpn_glossary/settings/a; type=boolean; label=Override fluid styled content layout to enable dynamic exclusion via content properties (default: enabled) + overrideFluidStyledContentLayout = 0 } } diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt index ae0ac09..94ff5b3 100755 --- a/Configuration/TypoScript/setup.txt +++ b/Configuration/TypoScript/setup.txt @@ -159,6 +159,15 @@ module.tx_dpnglossary.settings < plugin.tx_dpnglossary.settings page.includeCSS.dpnglossary = EXT:dpn_glossary/Resources/Public/css/styles.css [global] +["{$plugin.tx_dpnglossary.settings.overrideFluidStyledContentLayout}" == "1"] + lib.contentElement { + layoutRootPaths { + 50 = EXT:dpn_glossary/Resources/Private/Extensions/FluidStyledContent/Layouts + } + } +[global] + + config.pageTitleProviders { glossaryTerm { provider = Featdd\DpnGlossary\PageTitle\TermPageTitleProvider diff --git a/Documentation/Configuration/ExampleTypoScriptSetup/Index.rst b/Documentation/Configuration/ExampleTypoScriptSetup/Index.rst index ab66afe..004cdba 100644 --- a/Documentation/Configuration/ExampleTypoScriptSetup/Index.rst +++ b/Documentation/Configuration/ExampleTypoScriptSetup/Index.rst @@ -159,3 +159,64 @@ Add the following code to you setup: } Official documentaton: `https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/Seo/XmlSitemap.html` + +.. _example-exclude-pages: + +Exclude pages from being parsed +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Pages can be statically excluded from parsing via TypoScript:: + + plugin.tx_dpnglossary { + settings.parsingExcludePidList = 42, 185, 365 + } + +Pages can also dynamically excluded from parsing by page properties +:guilabel:`Page Properties > Behaviour > Settings for dreipunktnull Glossary`: + +.. figure:: /Images/ExcludePageFromParsing.png + :alt: Exclude page from parsing + + Exclude page from parsing + +By making field :sql:`tx_dpnglossary_parsing_settings` of table +:sql:`pages` available for your editors, it is also possible to let (power) +editors decide, which pages should be parsed. + +.. _example-exclude-content: + +Exclude content from being parsed +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following TypoScript constant defines HTML classes whose content will be +excluded from parsing:: + + plugin.tx_dpnglossary { + settings.forbiddenParsingTagClasses = tx_dpn_glossary_exclude, my_search_results + } + +Content wrapped with one of these classes will be excluded from parsing. + +Content can also dynamically excluded from parsing by content properties +:guilabel:`Content Properties > Appearance > Settings for DPN Glossary`. + +This only works if the default Fluid layout has been overriden to wrap the +content with the HTML class :html:`tx_dpn_glossary_exclude` and this class is +still found in the :typoscript:`settings.forbiddenParsingTagClasses`. + +You can set the following TypoScript constant to let this extension override +the Fluid Styled Content default layout:: + + plugin.tx_dpnglossary { + settings.overrideFluidStyledContentLayout = 1 + } + +If you need to override the layout yourself make sure to add the following to the +surrounding tags class: + +.. code-block:: html + +
+ +Just like with the pages this property can be used to enable editors to exclude +content elements from parsing. diff --git a/Documentation/Configuration/ExtensionSettings/Index.rst b/Documentation/Configuration/ExtensionSettings/Index.rst index af2e64e..eafd650 100644 --- a/Documentation/Configuration/ExtensionSettings/Index.rst +++ b/Documentation/Configuration/ExtensionSettings/Index.rst @@ -70,7 +70,8 @@ plugin.tx_dpnglossary.settings: string Description - Comma list of pages which should not be parsed + Comma list of pages which should not be parsed. Can be used to :ref:`exclude + pages from being pages ` .. container:: table-row @@ -148,8 +149,13 @@ plugin.tx_dpnglossary.settings: Data Type string + Default + tx_dpn_glossary_exclude + Description - Comma list of classes which are not allowed on any parent of the parsing tag + Comma list of classes which are not allowed on any parent of the parsing tag. + can be used to :ref:` exclude content from being parsed + ` .. container:: table-row @@ -246,4 +252,21 @@ plugin.tx_dpnglossary.settings: Description Comma list of special characters allowed to wrap the term + +.. container:: table-row + + Constant + settings.overrideFluidStyledContentLayout + + Data Type + boolean + + Description + If set the default layout of FluidStyledContent is overriden by this + extension. Can be used to :ref:`exclude content from being parsed + ` + + Default + 0 + .. ###### END~OF~TABLE ###### diff --git a/Documentation/Images/ExcludePageFromParsing.png b/Documentation/Images/ExcludePageFromParsing.png new file mode 100644 index 0000000..be9ac6f Binary files /dev/null and b/Documentation/Images/ExcludePageFromParsing.png differ diff --git a/Documentation/Includes.txt b/Documentation/Includes.txt index 655caa8..d838bc1 100644 --- a/Documentation/Includes.txt +++ b/Documentation/Includes.txt @@ -15,6 +15,7 @@ .. role:: js(code) .. role:: php(code) .. role:: typoscript(code) +.. role:: sql(code) .. role:: ts(typoscript) :class: typoscript diff --git a/Resources/Private/Extensions/FluidStyledContent/Layouts/Default.html b/Resources/Private/Extensions/FluidStyledContent/Layouts/Default.html new file mode 100644 index 0000000..e0ea65e --- /dev/null +++ b/Resources/Private/Extensions/FluidStyledContent/Layouts/Default.html @@ -0,0 +1,53 @@ + + + + +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+
+ + + + + + + + + + + + + + +
+
+ +
+
+ diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 0049206..697ffe1 100755 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -164,6 +164,22 @@ Einzigartig in der gesamten Instanz + + + + Einstellungen für das dreipunktnull Glossar + + + Seite parsen + + + + + Einstellungen für das dreipunktnull Glossar + + + Inhalt parsen + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index e7aabf8..6f1c845 100755 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -164,6 +164,22 @@ unique in the whole instance + + + + Settings for dreipunktnull Glossary + + + Parse page for glossary terms + + + + + Settings for dreipunktnull Glossary + + + Parse content element for glossary terms + diff --git a/ext_tables.sql b/ext_tables.sql index 8e396c6..6aa7bca 100755 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -132,3 +132,11 @@ CREATE TABLE tx_dpnglossary_domain_model_description ( KEY language(l10n_parent, sys_language_uid) ); + +CREATE TABLE pages ( + tx_dpnglossary_disable_parser tinyint(4) DEFAULT '0' NOT NULL +); + +CREATE TABLE tt_content ( + tx_dpnglossary_disable_parser tinyint(4) DEFAULT '0' NOT NULL +);