Skip to content

Commit

Permalink
feat: add support for site sets
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed May 6, 2024
1 parent c2596a2 commit 646c089
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 47 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Configuration/Sets/CodeHighlight/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: brotkrueml/codehighlight
label: CodeHighlight

dependencies:
- typo3/fluid-styled-content
13 changes: 13 additions & 0 deletions Configuration/Sets/CodeHighlight/constants.typoscript
Original file line number Diff line number Diff line change
@@ -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
}
17 changes: 17 additions & 0 deletions Configuration/Sets/CodeHighlight/settings.definitions.yaml
Original file line number Diff line number Diff line change
@@ -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'
31 changes: 31 additions & 0 deletions Configuration/Sets/CodeHighlight/setup.typoscript
Original file line number Diff line number Diff line change
@@ -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}
}
}
14 changes: 1 addition & 13 deletions Configuration/TypoScript/constants.typoscript
Original file line number Diff line number Diff line change
@@ -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"
32 changes: 1 addition & 31 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
`Unreleased <https://github.com/brotkrueml/codehighlight/compare/v4.0.0...HEAD>`_
-------------------------------------------------------------------------------------

Added
^^^^^


* Support for site sets in TYPO3 v13

`4.0.0 <https://github.com/brotkrueml/codehighlight/compare/v3.1.1...v4.0.0>`_ - 2024-02-14
-----------------------------------------------------------------------------------------------

Expand Down
104 changes: 101 additions & 3 deletions Documentation/Configuration/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <changelog:feature-103437-1712062105>` 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/<your-set>/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/<your-set>/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/<your-set>/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/<your-set>/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/<your-set>/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 <t3tsref:typoscript-syntax-constant-editor>`.
:ref:`constant editor <t3tsref:typoscript-syntax-constant-editor>`. For TYPO3
v13 it is recommended to use :ref:`site sets <site-sets>` instead.

Select the category :guilabel:`Codehighlight` and make your adjustments.

Expand Down
4 changes: 4 additions & 0 deletions Documentation/Installation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <site-sets>`.

#. Switch to the root page of your site.

#. Switch to the :guilabel:`Template module` and select :guilabel:`Info/Modify`.
Expand Down

0 comments on commit 646c089

Please sign in to comment.