From 646c08972bfca5027eefd3c707e1aea2279907ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20M=C3=BCller?= <2566282+brotkrueml@users.noreply.github.com> Date: Mon, 6 May 2024 11:12:04 +0200 Subject: [PATCH] feat: add support for site sets --- CHANGELOG.md | 3 + Configuration/Sets/CodeHighlight/config.yaml | 5 + .../Sets/CodeHighlight/constants.typoscript | 13 +++ .../CodeHighlight/settings.definitions.yaml | 17 +++ .../Sets/CodeHighlight/setup.typoscript | 31 ++++++ Configuration/TypoScript/constants.typoscript | 14 +-- Configuration/TypoScript/setup.typoscript | 32 +----- Documentation/Changelog/Index.rst | 6 + Documentation/Configuration/Index.rst | 104 +++++++++++++++++- Documentation/Installation/Index.rst | 4 + 10 files changed, 182 insertions(+), 47 deletions(-) create mode 100644 Configuration/Sets/CodeHighlight/config.yaml create mode 100644 Configuration/Sets/CodeHighlight/constants.typoscript create mode 100644 Configuration/Sets/CodeHighlight/settings.definitions.yaml create mode 100644 Configuration/Sets/CodeHighlight/setup.typoscript diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e51274..abfcb46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Support for site sets in TYPO3 v13 + ## [4.0.0] - 2024-02-14 ### Added diff --git a/Configuration/Sets/CodeHighlight/config.yaml b/Configuration/Sets/CodeHighlight/config.yaml new file mode 100644 index 0000000..8b39dab --- /dev/null +++ b/Configuration/Sets/CodeHighlight/config.yaml @@ -0,0 +1,5 @@ +name: brotkrueml/codehighlight +label: CodeHighlight + +dependencies: + - typo3/fluid-styled-content diff --git a/Configuration/Sets/CodeHighlight/constants.typoscript b/Configuration/Sets/CodeHighlight/constants.typoscript new file mode 100644 index 0000000..6e25486 --- /dev/null +++ b/Configuration/Sets/CodeHighlight/constants.typoscript @@ -0,0 +1,13 @@ +tt_content.tx_codehighlight_codesnippet { + # cat=codehighlight/file/p1; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:templateRootPath + templateRootPath = + + # cat=codehighlight/file/p2; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:partialRootPath + partialRootPath = + + # cat=codehighlight/file/p3; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:layoutRootPath + layoutRootPath = + + # cat=codehighlight/file/p4; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:cssFile + cssFile = EXT:codehighlight/Resources/Public/Css/codehighlight.css +} diff --git a/Configuration/Sets/CodeHighlight/settings.definitions.yaml b/Configuration/Sets/CodeHighlight/settings.definitions.yaml new file mode 100644 index 0000000..86980e8 --- /dev/null +++ b/Configuration/Sets/CodeHighlight/settings.definitions.yaml @@ -0,0 +1,17 @@ +settings: + tt_content.tx_codehighlight_codesnippet.templateRootPath: + label: 'LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:templateRootPath' + type: string + default: '' + tt_content.tx_codehighlight_codesnippet.partialRootPath: + label: 'LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:partialRootPath' + type: string + default: '' + tt_content.tx_codehighlight_codesnippet.layoutRootPath: + label: 'LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:partialRootPath' + type: string + default: '' + tt_content.tx_codehighlight_codesnippet.cssFile: + label: 'LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:cssFile' + type: string + default: 'EXT:codehighlight/Resources/Public/Css/codehighlight.css' diff --git a/Configuration/Sets/CodeHighlight/setup.typoscript b/Configuration/Sets/CodeHighlight/setup.typoscript new file mode 100644 index 0000000..662f56c --- /dev/null +++ b/Configuration/Sets/CodeHighlight/setup.typoscript @@ -0,0 +1,31 @@ +tt_content.tx_codehighlight_codesnippet =< lib.contentElement +tt_content.tx_codehighlight_codesnippet { + templateName = CodeSnippet + + templateRootPaths { + 0 = EXT:codehighlight/Resources/Private/Templates/ + 10 = {$tt_content.tx_codehighlight_codesnippet.templateRootPath} + } + partialRootPaths { + 0 = EXT:fluid_styled_content/Resources/Private/Partials/ + 10 = {$tt_content.tx_codehighlight_codesnippet.partialRootPath} + } + layoutRootPaths { + 0 = EXT:fluid_styled_content/Resources/Private/Layouts/ + 10 = {$tt_content.tx_codehighlight_codesnippet.layoutRootPath} + } + + dataProcessing { + 10 = TYPO3\CMS\Frontend\DataProcessing\FlexFormProcessor + 10.as = options + } + + variables { + snippet = USER + snippet.userFunc = Brotkrueml\CodeHighlight\UserFunctions\CodeSnippetGenerator->generate + } + + settings { + cssFile = {$tt_content.tx_codehighlight_codesnippet.cssFile} + } +} diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index 6e25486..839a41c 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -1,13 +1 @@ -tt_content.tx_codehighlight_codesnippet { - # cat=codehighlight/file/p1; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:templateRootPath - templateRootPath = - - # cat=codehighlight/file/p2; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:partialRootPath - partialRootPath = - - # cat=codehighlight/file/p3; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:layoutRootPath - layoutRootPath = - - # cat=codehighlight/file/p4; type=string; label=LLL:EXT:codehighlight/Resources/Private/Language/ConstantEditor.xlf:cssFile - cssFile = EXT:codehighlight/Resources/Public/Css/codehighlight.css -} +@import "EXT:codehighlight/Configuration/Sets/CodeHighlight/constants.typoscript" diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 662f56c..2f8085a 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -1,31 +1 @@ -tt_content.tx_codehighlight_codesnippet =< lib.contentElement -tt_content.tx_codehighlight_codesnippet { - templateName = CodeSnippet - - templateRootPaths { - 0 = EXT:codehighlight/Resources/Private/Templates/ - 10 = {$tt_content.tx_codehighlight_codesnippet.templateRootPath} - } - partialRootPaths { - 0 = EXT:fluid_styled_content/Resources/Private/Partials/ - 10 = {$tt_content.tx_codehighlight_codesnippet.partialRootPath} - } - layoutRootPaths { - 0 = EXT:fluid_styled_content/Resources/Private/Layouts/ - 10 = {$tt_content.tx_codehighlight_codesnippet.layoutRootPath} - } - - dataProcessing { - 10 = TYPO3\CMS\Frontend\DataProcessing\FlexFormProcessor - 10.as = options - } - - variables { - snippet = USER - snippet.userFunc = Brotkrueml\CodeHighlight\UserFunctions\CodeSnippetGenerator->generate - } - - settings { - cssFile = {$tt_content.tx_codehighlight_codesnippet.cssFile} - } -} +@import "EXT:codehighlight/Configuration/Sets/CodeHighlight/setup.typoscript" diff --git a/Documentation/Changelog/Index.rst b/Documentation/Changelog/Index.rst index c28f378..c0ccfa7 100644 --- a/Documentation/Changelog/Index.rst +++ b/Documentation/Changelog/Index.rst @@ -11,6 +11,12 @@ and this project adheres to `Semantic Versioning `_ ------------------------------------------------------------------------------------- +Added +^^^^^ + + +* Support for site sets in TYPO3 v13 + `4.0.0 `_ - 2024-02-14 ----------------------------------------------------------------------------------------------- diff --git a/Documentation/Configuration/Index.rst b/Documentation/Configuration/Index.rst index 8711308..f06bcde 100644 --- a/Documentation/Configuration/Index.rst +++ b/Documentation/Configuration/Index.rst @@ -90,13 +90,111 @@ If the option is enabled, a :guilabel:`Copy` button is displayed in the upper right corner when the user moves the mouse pointer over a code snippet. +.. _site-sets: + +Site sets (TYPO3 v13) +===================== + +.. todo: Change reference from changelog to official manual once available. + +This extension provides support for +:ref:`site sets ` introduced with TYPO3 +v13.1. + +Add :yaml:`brotkrueml/codehighlight` as dependency to the configuration of +your site package: + +.. code-block:: yaml + :caption: EXT:your_sitepackage/Configuration/Sets//config.yaml + :emphasize-lines: 7 + + name: your-vendor/your-sitepackage + label: Sitepackage + + dependencies: + # ... some other dependencies + + - brotkrueml/codehighlight + +Settings +-------- + +If you want to change the layout or template of the content element or add a +partial you can make a copy of them and adjust the Fluid root paths. + +Path to template root +~~~~~~~~~~~~~~~~~~~~~ + +Define the additional template root path, for example, +:file:`EXT:your_sitepackage/Resources/Private/Templates/Codehighlight/`. + +.. code-block:: yaml + :caption: EXT:your_sitepackage/Configuration/Sets//settings.yaml + :emphasize-lines: 3-5 + + # ... some other settings + + tt_content: + tx_codehighlight_codesnippet: + templateRootPath: 'EXT:your_sitepackage/Resources/Private/Templates/Codehighlight/' + +Path to template partials +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Define the additional partial root path, for example, +:file:`EXT:your_sitepackage/Resources/Private/Partials/Codehighlight/`. + +.. code-block:: yaml + :caption: EXT:your_sitepackage/Configuration/Sets//settings.yaml + :emphasize-lines: 3-5 + + # ... some other settings + + tt_content: + tx_codehighlight_codesnippet: + partialRootPath: 'EXT:your_sitepackage/Resources/Private/Partials/Codehighlight/' + +Path to template layouts +~~~~~~~~~~~~~~~~~~~~~~~~ + +Define the additional layout root path, for example, +:file:`EXT:your_sitepackage/Resources/Private/Layouts/Codehighlight/`. + +.. code-block:: yaml + :caption: EXT:your_sitepackage/Configuration/Sets//settings.yaml + :emphasize-lines: 3-5 + + # ... some other settings + + tt_content: + tx_codehighlight_codesnippet: + layoutRootPath: 'EXT:your_sitepackage/Resources/Private/Layouts/Codehighlight/' + +CSS file +~~~~~~~~ + +The extension comes with a default CSS file. If you don't want to include it or +want to use an own CSS file you can empty the field or change the path. + +.. code-block:: yaml + :caption: EXT:your_sitepackage/Configuration/Sets//settings.yaml + :emphasize-lines: 3-5 + + # ... some other settings + + tt_content: + tx_codehighlight_codesnippet: + cssFile: 'EXT:your_sitepackage/Resources/Public/Css/codehighlight.css' + + .. _constant-editor: -Constant editor -=============== +Constant editor (TYPO3 v12, and v13 without site sets) +====================================================== Some constants can be defined in the -:ref:`constant editor `. +:ref:`constant editor `. For TYPO3 +v13 it is recommended to use :ref:`site sets ` instead. Select the category :guilabel:`Codehighlight` and make your adjustments. diff --git a/Documentation/Installation/Index.rst b/Documentation/Installation/Index.rst index 9ce61d4..a902cb1 100644 --- a/Documentation/Installation/Index.rst +++ b/Documentation/Installation/Index.rst @@ -54,6 +54,10 @@ Preparation: Include static TypoScript The extension ships some TypoScript code which needs to be included. +.. note:: + This needs only to be done, if **not** using TYPO3 v13 with + :ref:`site sets `. + #. Switch to the root page of your site. #. Switch to the :guilabel:`Template module` and select :guilabel:`Info/Modify`.