-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: #97271 - New TCA type “color” (#570)
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Feature-97271-NewTCATypeColor.html refs TYPO3-Documentation/TYPO3CMS-Reference-CoreApi#1624 Co-authored-by: lina.wolf <[email protected]> Co-authored-by: Nikita Hovratov <[email protected]>
- Loading branch information
1 parent
8394408
commit aa7bd80
Showing
14 changed files
with
227 additions
and
76 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
.. _columns-input-renderType-colorpicker: | ||
.. _columns-color: | ||
|
||
===== | ||
Color | ||
===== | ||
|
||
.. versionadded:: 12.0 | ||
The TCA type :php:`color` has been introduced. It replaces the | ||
:php:`renderType=colorpicker` of TCA type :php:`input`. | ||
|
||
|
||
The TCA type :php:`color` should be used to render a JavaScript based color-picker. | ||
|
||
Examples | ||
======== | ||
|
||
A simple color picker: | ||
|
||
.. code-block:: php | ||
'a_color_field' => [ | ||
'label' => 'Color field', | ||
'config' => [ | ||
'type' => 'color', | ||
] | ||
] | ||
Migration | ||
========= | ||
|
||
A complete migration from :php:`renderType=colorpicker` to :php:`type=color` | ||
looks like the following: | ||
|
||
.. code-block:: php | ||
// Before | ||
'a_color_field' => [ | ||
'label' => 'Color field', | ||
'config' => [ | ||
'type' => 'input', | ||
'renderType' => 'colorpicker', | ||
'required' => true, | ||
'size' => 20, | ||
'max' => 1024, | ||
'eval' => 'trim', | ||
'valuePicker' => [ | ||
'items' => [ | ||
['typo3 orange', '#FF8700'], | ||
], | ||
], | ||
], | ||
], | ||
// After | ||
'a_color_field' => [ | ||
'label' => 'Color field', | ||
'config' => [ | ||
'type' => 'color', | ||
'required' => true, | ||
'size' => 20, | ||
'valuePicker' => [ | ||
'items' => [ | ||
['typo3 orange', '#FF8700'], | ||
], | ||
], | ||
] | ||
] | ||
An automatic TCA migration is performed on the fly, migrating all occurrences | ||
to the new TCA type and triggering a PHP :php:`E_USER_DEPRECATED` error | ||
where code adoption has to take place. | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
Properties/Index |
38 changes: 38 additions & 0 deletions
38
Documentation/ColumnsConfig/Type/Color/Properties/Eval.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-color-properties-eval: | ||
|
||
==== | ||
eval | ||
==== | ||
|
||
.. confval:: eval (type => color) | ||
|
||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string (list of keywords) | ||
:Scope: Display / Proc. | ||
|
||
Configuration of field evaluation. | ||
|
||
null | ||
An empty value (string) will be stored as :code:`NULL` in the database, | ||
requires a proper sql definition. | ||
|
||
.. note:: | ||
|
||
The value of TCA type :php:`color` columns is automatically trimmed before | ||
being stored in the database. Therefore, the :php:`eval=trim` option is no | ||
longer needed and should be removed from the TCA configuration. The only | ||
valid option for :php:`eval` is :php:`null`. | ||
|
||
Examples | ||
======== | ||
|
||
.. code-block:: php | ||
'aField' => [ | ||
'label' => 'aLabel', | ||
'config' => [ | ||
'type' => 'color', | ||
'eval' => 'null', | ||
], | ||
], |
34 changes: 34 additions & 0 deletions
34
Documentation/ColumnsConfig/Type/Color/Properties/Index.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-color-properties: | ||
|
||
========== | ||
Properties | ||
========== | ||
|
||
Special properties | ||
================== | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
Eval | ||
Size | ||
ValuePicker | ||
|
||
Common properties | ||
================= | ||
|
||
* :ref:`behaviour > allowLanguageSynchronization <tca_property_behaviour_allowLanguageSynchronization>` | ||
* :ref:`default <tca_property_default>` | ||
* :ref:`fieldControl <tca_property_fieldControl>` | ||
* :ref:`fieldInformation <tca_property_fieldInformation>` | ||
* :ref:`fieldWizard <tca_property_fieldWizard>` with the following options | ||
|
||
* :ref:`defaultLanguageDifferences <tca_property_fieldwizard>` | ||
* :ref:`localizationStateSelector <tca_property_fieldWizard_localizationStateSelector>` | ||
* :ref:`otherLanguageContent <tca_property_fieldWizard_otherLanguageContent>` | ||
|
||
* :ref:`mode <tca_property_mode>` | ||
* :ref:`placeholder <tca_property_placeholder>` | ||
* :ref:`readOnly <tca_property_readOnly>` | ||
* :ref:`required <tca_property_required>` |
16 changes: 16 additions & 0 deletions
16
Documentation/ColumnsConfig/Type/Color/Properties/Size.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-color-properties-size: | ||
|
||
==== | ||
size | ||
==== | ||
|
||
.. confval:: size (type => color) | ||
|
||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: integer | ||
:Scope: Display | ||
|
||
Abstract value for the width of the :code:`<input>` field. To set the | ||
field to the full width of the form area, use the value 50. Minimum is 10. | ||
Default is 30. |
44 changes: 44 additions & 0 deletions
44
Documentation/ColumnsConfig/Type/Color/Properties/ValuePicker.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-color-properties-valuePicker: | ||
|
||
=========== | ||
valuePicker | ||
=========== | ||
|
||
.. confval:: valuePicker (type => color) | ||
|
||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: array | ||
:Scope: Display | ||
|
||
Renders a select box with static values next to the input field. When a | ||
value is selected in the box, the value is transferred to the field. Keys: | ||
|
||
items (array) | ||
An array with selectable items. Each item is an array with the first value being the label in the select | ||
drop-down (LLL reference possible) the second being the hex-value transferred to the input field. | ||
The value should have exactly 7 characters, as this is the maximum for a hex-value. | ||
|
||
.. note:: | ||
|
||
The :php:`valuePicker` allows to define default color codes via :php:`items` | ||
for a TCA type :php:`color` field. | ||
|
||
Example | ||
======= | ||
|
||
.. code-block:: php | ||
'a_color_field' => [ | ||
'label' => 'Color field', | ||
'config' => [ | ||
'type' => 'color', | ||
'required' => true, | ||
'size' => 20, | ||
'valuePicker' => [ | ||
'items' => [ | ||
['typo3 orange', '#FF8700'], | ||
], | ||
], | ||
] | ||
] |
18 changes: 4 additions & 14 deletions
18
Documentation/ColumnsConfig/Type/Input/ColorPicker/Examples.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
.. include:: /Includes.rst.txt | ||
:orphan: | ||
|
||
======== | ||
Examples | ||
======== | ||
|
||
|
||
.. _tca_example_input_34: | ||
|
||
Color picker field | ||
================== | ||
|
||
.. include:: /Images/Rst/Input34.rst.txt | ||
|
||
.. include:: /CodeSnippets/Input34.rst.txt | ||
.. deprecated:: 12.0 | ||
The :php:`renderType=colorpicker` of TCA type :php:`input` has been | ||
deprecated. Use the TCA type :ref:`color <columns-color>` instead. |
18 changes: 4 additions & 14 deletions
18
Documentation/ColumnsConfig/Type/Input/ColorPicker/Index.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
.. include:: /Includes.rst.txt | ||
:orphan: | ||
|
||
.. _columns-input-renderType-colorpicker: | ||
|
||
=========== | ||
Colorpicker | ||
=========== | ||
|
||
This page describes the :ref:`input <columns-input>` type with renderType='colorpicker'. | ||
|
||
An input field with a JavaScript color picker. | ||
|
||
.. toctree:: | ||
|
||
Examples | ||
.. deprecated:: 12.0 | ||
The :php:`renderType=colorpicker` of TCA type :php:`input` has been | ||
deprecated. Use the TCA type :ref:`color <columns-color>` instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters