Skip to content

Commit

Permalink
Merge branch 'main' into php-84
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf authored Sep 24, 2024
2 parents 6a7ff79 + 3873905 commit a0766dc
Show file tree
Hide file tree
Showing 18 changed files with 323 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.bak
*.idea
.Build/*
config/
*.project
*.swp
*NOT_VERSIONED*
Expand Down
5 changes: 2 additions & 3 deletions Documentation/ApiOverview/CommandControllers/ListCommands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
List of TYPO3 console commands
==============================

.. todo: List all common commands once https://forge.typo3.org/issues/103858 is resolved
By default TYPO3 ships the listed console commands, depending
on which system extensions are installed.

Expand All @@ -28,7 +26,8 @@ on legacy installations:
List all TYPO3 console commands
===============================

.. console:command:: list
.. console:command-list::
:json: commands.json
:script: vendor/bin/typo3
:exclude-option: help, quiet, verbose, version, ansi, no-ansi, no-interaction
:exclude-namespace: clinspector, codesnippet, examples, styleguide
2 changes: 1 addition & 1 deletion Documentation/ApiOverview/CommandControllers/commands.json

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions Documentation/ApiOverview/ContentSecurityPolicy/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ web page context.
Content Security Policy declarations can be applied to a TYPO3 website in
frontend and backend scope with a dedicated API.

To delegate Content Security Policy handling to TYPO3 frontend, the feature flag
:ref:`security.frontend.enforceContentSecurityPolicy <typo3ConfVars_sys_features_security.frontend.enforceContentSecurityPolicy>`
needs to be enabled.
To delegate Content Security Policy handling to TYPO3 frontend, at least one of
the feature flags

* :confval:`globals-typo3-conf-vars-sys-features-security-frontend-enforceContentSecurityPolicy`
(for enforcing)
* :confval:`globals-typo3-conf-vars-sys-features-security-frontend-reportContentSecurityPolicy`
(for report-only mode, available since TYPO3 v12.4.20)

need to be enabled.

.. versionchanged:: 13.0

Expand Down
1 change: 1 addition & 0 deletions Documentation/ApiOverview/SiteHandling/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ through the features of the module and goes into API and programming details.
SiteSets
SiteSettings
SiteSettingDefinitions
SiteSettingsEditor
CliTools
AccessingSiteConfiguration
ExtendingSiteConfig
217 changes: 158 additions & 59 deletions Documentation/ApiOverview/SiteHandling/SiteSettingDefinitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,187 @@ Site settings definitions
=========================

.. versionadded:: 13.1
Site-scoped setting definitions where introduced. They will most likely be
the place to configure site-wide configuration, which was previously only
possible to modify via modifying TypoScript constants, for example in the
Constant Editor.

The big problem with TypoScript and TSConfig is that each specified value can
only ever be a string. It is up to the developer alone to read these values
and convert them into the desired data type such as integer.
Site settings definitions allow to define settings with a type and a guaranteed
default value. They can be defined in :ref:`site-sets`, in a file called
:file:`settings.definitions.yaml`.

TYPO3 wants to remedy this with settings definitions and now provides an API
with which you can add additional descriptive definitions for each individual
site setting.
It is recommended to use site-sets and their UI configuration in favor of
TypoScript Constants.

.. literalinclude:: _Settings/_settings.definitions.yaml
:caption: EXT:my_extension/Configuration/Sets/MySet/settings.definitions.yaml
All available settings are displayed in the :ref:`site-settings-editor`.

The site settings provided by an extension can be automatically documented in the
extensions manual, see
:ref:`site settings documentation <h2document:reference-site-settings>`.

.. contents:: Table of contents

.. _site-settings-definition-example:

Site setting definition example
===============================

.. literalinclude:: _Settings/_blog_settings.definitions.yaml
:caption: EXT:blog_example/Configuration/Sets/BlogExample/settings.definitions.yaml (Excerpt)

See the complete example at
`settings.definitions.yaml (GitHub) <https://github.com/TYPO3-Documentation/blog_example/blob/main/Configuration/Sets/BlogExample/settings.definitions.yaml>`__.

.. figure:: /Images/ManualScreenshots/SiteHandling/SiteSettingsDefinition.png
:alt: Screenshot demonstration the position of the categories, labels etc

The parts marked by a number can be configured, see list bellow


.. _site-settings-definition-properties:

Site setting definition properties
==================================

.. confval-menu::
:display: table
:name: site-setting-definition
:type:
:required:

.. confval:: categories
:type: array
:name: site-settings-definition-categories

.. confval:: label
:type: string
:name: site-settings-definition-categories-label

.. confval:: parent
:type: :confval:`site-settings-definition-categories` key
:name: site-settings-definition-categories-parent

.. confval:: settings
:type: array
:name: site-settings-definition-settings

.. confval:: label
:type: string
:name: site-settings-definition-settings-label

.. confval:: description
:type: string
:name: site-settings-definition-settings-description

.. confval:: category
:type: :confval:`site-settings-definition-categories` key
:name: site-settings-definition-settings-category

.. confval:: type
:type: a :ref:`definition type <definition-types>`
:name: site-settings-definition-settings-type
:required:

.. confval:: default
:type: mixed
:name: site-settings-definition-settings-default
:required:

The default value must have the same type like defined in
:confval:`site-settings-definition-settings-type`.

.. confval:: readonly
:type: bool
:name: site-settings-definition-settings-readonly

If a site setting is marked as readonly, it can be overridden only
by editing the :file:`config/sites/my-site/settings.yaml` directly,
but not from within the editor.

.. _definition-types:

Definition types
================

.. confval:: int
:name: site-setting-type-int
:type: string
:Path: settings.[my_val].type = int
.. confval-menu::
:display: table
:name: site-setting-type
:type:
:required:

.. confval:: int
:name: site-setting-type-int
:type: string
:Path: settings.[my_val].type = int

Checks whether the value is already an integer or can be interpreted as an
integer. If yes, the string is converted into an integer.

.. confval:: number
:name: site-setting-type-number
:type: string
:Path: settings.[my_val].type = number

Checks whether the value is already an integer or float or whether the
string can be interpreted as an integer or float. If yes, the string is
converted to an integer or float.

.. confval:: bool
:name: site-setting-type-bool
:type: string
:Path: settings.[my_val].type = bool

Checks whether the value is already an integer or can be interpreted as an
integer. If yes, the string is converted into an integer.
If the value is already a boolean, it is returned directly 1 to 1.

.. confval:: number
:name: site-setting-type-number
:type: string
:Path: settings.[my_val].type = number
If the value is an integer, then `false` is returned for 0 and `true` for 1.

Checks whether the value is already an integer or float or whether the
string can be interpreted as an integer or float. If yes, the string is
converted to an integer or float.
If the value is a string, the corresponding Boolean value is returned for
`true`, `false`, `yes`, `no`, `on`, `off`, `0` and `1`.

.. confval:: bool
:name: site-setting-type-bool
:type: string
:Path: settings.[my_val].type = bool
.. confval:: string
:name: site-setting-type-string
:type: string
:Path: settings.[my_val].type = string

If the value is already a boolean, it is returned directly 1 to 1.
Converts almost all data types into a string. If an object has been
specified, it must be `stringable`, otherwise no conversion takes place.
Boolean values are converted to `true` and `false`.

If the value is an integer, then `false` is returned for 0 and `true` for 1.
.. confval:: text
:name: site-setting-type-text
:type: string
:Path: settings.[my_val].type = text

If the value is a string, the corresponding Boolean value is returned for
`true`, `false`, `yes`, `no`, `on`, `off`, `0` and `1`.
Exactly the same as the `string` type. Use it as an alias if someone doesn't
know what to do with `string`.

.. confval:: string
:name: site-setting-type-string
:type: string
:Path: settings.[my_val].type = string
.. confval:: stringlist
:name: site-setting-type-stringlist
:type: string
:Path: settings.[my_val].type = stringlist

Converts almost all data types into a string. If an object has been
specified, it must be `stringable`, otherwise no conversion takes place.
Boolean values are converted to `true` and `false`.
The value must be an array whose array key starts at 0 and increases by 1 per element. This sequence is
checked using the internal PHP method array_is_list in order to prevent named array keys from the outset.
This also means that comma-separated lists cannot be converted here.

.. confval:: text
:name: site-setting-type-text
:type: string
:Path: settings.[my_val].type = text
The `string` type is executed for each array entry.

Exactly the same as the `string` type. Use it as an alias if someone doesn't
know what to do with `string`.
.. confval:: color
:name: site-setting-type-color
:type: string
:Path: settings.[my_val].type = color

.. confval:: stringlist
:name: site-setting-type-stringlist
:type: string
:Path: settings.[my_val].type = stringlist
Checks whether the specified string can be interpreted as a color code.
Entries starting with `rgb`, `rgba` and `#` are permitted here.

The value must be an array whose array keys start at 0 and increase by 1 per
element. The list in this type is derived from the internal PHP method
`array_is_list` and has nothing to do with the fact that comma-separated
lists can also be converted here.
For `#` color codes, for example, the system checks whether they
have 3, 6 or 8 digits.

The `string` type is executed for each array entry.

.. confval:: color
:name: site-setting-type-color
:type: string
:Path: settings.[my_val].type = color
.. figure:: /Images/ManualScreenshots/SiteHandling/SiteSettingsTypes1.png
:alt: Screenshot demonstration the input fields for different setting types (Part 1)

Checks whether the specified string can be interpreted as a color code.
Entries starting with `rgb`, `rgba` and `#` are permitted here.
.. figure:: /Images/ManualScreenshots/SiteHandling/SiteSettingsTypes2.png
:alt: Screenshot demonstration the input fields for different setting types (Part 2)

For `#` color codes, for example, the system checks whether they
have 3, 6 or 8 digits.
A demonstration of the different setting types
16 changes: 5 additions & 11 deletions Documentation/ApiOverview/SiteHandling/SiteSettings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
Site settings
=============

.. versionchanged:: 12.1
Before TYPO3 v12.1 the site settings were stored in the :file:`config.yaml`
file under the :yaml:`settings` key. An upgrade wizard copies the settings
to the new :file:`settings.yaml` file.

Settings are not removed from the :file:`config.yaml` file for now, but will
not have any effect anymore as soon as a :file:`settings.yaml` file exists.

Please review your settings in the :file:`config.yaml` file and remove them
manually. Eventually, you need and/or want to adopt your deployment
workflow.
.. versionadded:: 13.1
Site settings can receive a type, a default value and some documentation in
:ref:`site settings definitions <site-sets-settings-definition>`. It is
recommended to always define a site setting before using it, as only this way
you can ensure proper types and default values.

Site settings can be used to provide settings for a site. They can be accessed
via
Expand Down
Loading

0 comments on commit a0766dc

Please sign in to comment.