Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Merge properties back into ctrl page #1155

Merged
merged 13 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Documentation/BestPractises/CommonFields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Soft delete
This field is used to enable soft delete in records. In can be configured
by setting :ref:`ctrl->delete <ctrl-reference-delete>`:

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_Delete.php
.. literalinclude:: /Ctrl/_CodeSnippets/_Delete.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php


Expand All @@ -74,7 +74,7 @@ Enablecolumns
This field is used to enable soft hiding of records. In can be configured
by setting :ref:`ctrl->enablecolumns->disabled <ctrl-reference-enablecolumns>`:

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_Hidden.php
.. literalinclude:: /Ctrl/_CodeSnippets/_Hidden.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

.. _field_starttime:
Expand All @@ -85,7 +85,7 @@ Enablecolumns
an endtime. In can be configured
by :ref:`ctrl->enablecolumns->starttime or endtime <ctrl-reference-enablecolumns>`:

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_StarttimeEndtime.php
.. literalinclude:: /Ctrl/_CodeSnippets/_StarttimeEndtime.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

.. _field_fe_group:
Expand All @@ -94,7 +94,7 @@ Enablecolumns
This field is used to enable soft delete of records. In can be configured
by :ref:`ctrl->enablecolumns->fe_group <ctrl-reference-enablecolumns>`:

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_FeGroup.php
.. literalinclude:: /Ctrl/_CodeSnippets/_FeGroup.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

.. warning::
Expand All @@ -111,7 +111,7 @@ Manual sorting in the backend
This field is used to manually sort records in the backend. In can be configured
by :ref:`ctrl->sortby <ctrl-reference-sortby>`:

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_Sorting.php
.. literalinclude:: /Ctrl/_CodeSnippets/_Sorting.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

.. attention::
Expand All @@ -132,7 +132,7 @@ The following fields are automatically set when a record is written by the
displayed in backend forms or explicitly set, therefore they need no entry in
the :ref:`columns` section of the TCA.

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_DataHandlerFields.php
.. literalinclude:: /Ctrl/_CodeSnippets/_DataHandlerFields.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

.. _field_tstamp:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/BestPractises/LanguageFields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ Language fields in detail
Example: Enable table for localization and translation:
=======================================================

.. literalinclude:: /Ctrl/Properties/_CodeSnippets/_Language.php
.. literalinclude:: /Ctrl/_CodeSnippets/_Language.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

8 changes: 5 additions & 3 deletions Documentation/Ctrl/AutoCreatedColumns.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:navigation-title: Auto-created columns

.. include:: /Includes.rst.txt
.. _ctrl-auto-created-columns:

Expand Down Expand Up @@ -63,17 +65,17 @@ then override single properties in :file:`Configuration/TCA/Overrides` files.

As example, "base" :php:`pages` file defines this (step 1 above):

.. literalinclude:: _AutoCreatedColumns/_pages.php
.. literalinclude:: _CodeSnippets/_AutoCreatedColumns/_pages.php
:caption: EXT:core/Configuration/TCA/pages.php (Excerpt)

The Core thus creates this :php:`columns` definition (step 2 above):

.. literalinclude:: _AutoCreatedColumns/_autoCreatePages.php
.. literalinclude:: _CodeSnippets/_AutoCreatedColumns/_autoCreatePages.php
:caption: Column entries created by the Core

When an editor creates a new page, it should be "disabled" by default to
avoid having a new page online in the website before it is set up completely.
A :file:`Configuration/TCA/Overrides/pages.php` file does this:

.. literalinclude:: _AutoCreatedColumns/_OverrideHiddenDefault.php
.. literalinclude:: _CodeSnippets/_AutoCreatedColumns/_OverrideHiddenDefault.php
:caption: EXT:my_extension/Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
@@ -1,61 +1,21 @@
.. include:: /Includes.rst.txt
.. _ctrl-reference-enablecolumns:
:navigation-title: Enabling columns

=============
enablecolumns
=============
.. include:: /Includes.rst.txt
.. _ctrl-enablecolumns:
froemken marked this conversation as resolved.
Show resolved Hide resolved

.. confval:: enablecolumns
:name: ctrl-enablecolumns
:Path: $GLOBALS['TCA'][$table]['ctrl']
:type: array
:Scope: Proc. / Display

.. versionchanged:: 13.3
The column definitions for these settings are :ref:`auto-created <ctrl-auto-created-columns>`.

Specifies which *publishing control features* are automatically implemented for the table.

This includes that records can be "disabled" or "hidden", have a starting and/or ending time and be access
controlled so only a certain front end user group can access them. This property is used by the
:ref:`RestrictionBuilder <t3coreapi:database-restriction-builder>` to create SQL fragments.

These are the keys in the array you can use. Each of the values must be a field name in the table which
should be used for the feature:

`disabled`
Defines which field serves as hidden/disabled flag.

`starttime`
Defines which field contains the starting time.

`endtime`
Defines which field contains the ending time.

`fe_group`
Defines which field is used for access control via a selection of FE user groups.

.. note::
In general these fields do *not* affect the access or display in the backend! They are primarily
related to the frontend. However the icon of records having these features enabled will
normally change as these examples show:

.. include:: /Images/Rst/CtrlEnableFields.rst.txt

.. include:: _AutoCreateWarning.rst.txt

See also the :ref:`delete <ctrl-reference-delete>` and
:ref:`ctrl-reference-editlock` features which are related,
but are active for both frontend and backend.
=======================================================
How to use `enablecolumns` in the `ctrl` section of TCA
=======================================================

.. _ctrl-reference-enablecolumns-migration:

Migration: Remove enable column definitions (hidden, starttime, endtime, fe_groups) from TCA
============================================================================================
Migration
=========

Migration: Remove enable column definitions (hidden, starttime, endtime, fe_groups) from TCA
On dropping TYPO3 v12.4 support extensions authors can drop the column
definitions of the enable fields. They need to keep the :ref:`palettes` and
:ref:`type` definitions, however:
:ref:`types` definitions, however:

.. literalinclude:: _CodeSnippets/_Enablecolumns.diff
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
Expand All @@ -65,11 +25,11 @@ definitions of the enable fields. They need to keep the :ref:`palettes` and
Examples of column enable configurations
========================================

.. _ctrl-reference-enablecolumns-examples-all:

.. literalinclude:: _CodeSnippets/_Enablecolumns.php
:caption: EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php

.. _ctrl-reference-enablecolumns-examples-all:

Define all enablecolumn fields
==============================

Expand Down
105 changes: 73 additions & 32 deletions Documentation/Ctrl/Examples.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
.. include:: /Includes.rst.txt
.. _ctrl-examples:
:navigation-title: Examples

========
Examples
========
.. include:: /Includes.rst.txt
.. _ctrl-examples:

.. _tca_example_ctrl_minimal:
==============================================
Examples demonstrating the ctrl section of TCA
==============================================

A common table has a configuration such as this:

.. include:: /CodeSnippets/TxStyleguideCtrlCommon.rst.txt

.. _tca_example_ctrl_minimal:

Minimal table configuration
===========================

.. include:: /Images/Rst/TxStyleguideCtrlMinimal.rst.txt
.. include:: /Images/Rst/TxStyleguideCtrlMinimal.rst.txt

.. include:: /CodeSnippets/TxStyleguideCtrlMinimal.rst.txt
.. include:: /CodeSnippets/TxStyleguideCtrlMinimal.rst.txt

Property :code:`label` is a mandatory setting, but the above properties are a recommended
minimum. The list module shows an icon and a translated title of the table, and it uses the value of
Expand All @@ -22,41 +28,76 @@ possible, and much more. In the database, only columns :code:`uid`, :code:`pid`
in :file:`ext_tables.sql` with this setup.


.. _tca_example_ctrl_common:

Common table control configuration
==================================

.. include:: /Images/Rst/TxStyleguideCtrlCommon.rst.txt

.. include:: /CodeSnippets/TxStyleguideCtrlCommon.rst.txt

.. _tca_example_ctrl_tt_content:
.. _tca_example_ctrl_tt_content:

Core table tt_content
=====================

Table :code:`tt_content` makes much more excessive use of the :code:`['ctrl']` section:

.. include:: /CodeSnippets/TtContentCtrl.rst.txt
.. include:: /CodeSnippets/TtContentCtrl.rst.txt

A few remarks:

- When tt_content records are displayed in the backend, the "label" property
indicates that you will see the content from the field named "header"
shown as the title of the record. If that field is empty, the content of field
subheader and if empty, of field bodytext is used as title.
* When tt_content records are displayed in the backend, the "label" property
indicates that you will see the content from the field named "header"
shown as the title of the record. If that field is empty, the content of field
subheader and if empty, of field bodytext is used as title.

* The field called "sorting" will be used to determine the order in
which tt_content records are displayed within each branch of the page tree.

* The title for the table as shown in the backend is defined as coming from a "locallang" file.

* The "type" field will be the one named "CType". The value of this field determines the set of fields
shown in the edit forms in the backend, see the :ref:`['types'] <types>` section for details.

* Of particular note is the "enablecolumns" property. It is quite extensive for this table since it is a
frontend-related table. Thus proper access rights, publications dates, etc. must be enforced.

* Every type of content element has its own icon and its own class, used in conjunction with the
:ref:`Icon API <t3coreapi:icon>` to visually represent that type in the TYPO3 backend.


.. _tca_example_ctrl_container:

Extended container examples
===========================

.. _tca_example_ctrl_container-disable:

Disable a built-in wizard
-------------------------

.. literalinclude:: _CodeSnippets/_disableFieldWizard.php

This disables the default :php:`localizationStateSelector` fieldWizard of
:php:`inlineControlContainer`.

.. _tca_example_ctrl_container-cusotm:

Add your own wizard
-------------------

Register an own node in a :file:`ext_localconf.php`:

.. literalinclude:: _CodeSnippets/_WizardRegistration/_ext_localconf.php
:caption: EXT:my_extension/ext_localconf.php

Register the new node as `fieldWizard` of `tt_content` table in an
:file:`Configuration/TCA/Overrides/tt_content.php` file:

.. literalinclude:: _CodeSnippets/_WizardRegistration/_ext_localconf.php
:caption: EXT:my_extension/Configuration/TCA/Overrides/tt_content.php

- The field called "sorting" will be used to determine the order in
which tt_content records are displayed within each branch of the page tree.
In PHP, the node has to implement an interface, but can return any additional HTML which is rendered in the
"OuterWrapContainer" between the record title and the field body when editing a record:

- The title for the table as shown in the backend is defined as coming from a "locallang" file.
.. include:: /Images/ManualScreenshots/OuterFieldWizard.rst.txt

- The "type" field will be the one named "CType". The value of this field determines the set of fields
shown in the edit forms in the backend, see the :ref:`['types'] <types>` section for details.
.. _tca_example_ctrl_container-inline:

- Of particular note is the "enablecolumns" property. It is quite extensive for this table since it is a
frontend-related table. Thus proper access rights, publications dates, etc. must be enforced.
Add fieldInformation to field of type inline
--------------------------------------------

- Every type of content element has its own icon and its own class, used in conjunction with the
:ref:`Icon API <t3coreapi:icon>` to visually represent that type in the TYPO3 backend.
This example can be found in :ref:`inline-example-field-information`.
31 changes: 28 additions & 3 deletions Documentation/Ctrl/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,35 @@ These properties are basically divided into two main categories:
(TCE). This includes the publishing control, the "deleted" flag, whether a table
can only be edited by admin-users, whether a table may only exist in the tree root etc.

.. contents::

.. toctree::
:titlesonly:
:glob:

AutoCreatedColumns
Examples
Properties/Index
*

.. _tca_example_ctrl_common:

Example: Common table control configuration
===========================================

For advanced examples see :ref:`ctrl-examples`.

.. include:: /Images/Rst/TxStyleguideCtrlCommon.rst.txt

.. include:: /CodeSnippets/TxStyleguideCtrlCommon.rst.txt

.. _ctrl-reference:

Properties of the TCA ctrl section
==================================

.. confval-menu::
:name: ctrl
:display: table
:type:
:Scope:

.. include:: _Properties/_*.rst.txt
:show-buttons:
27 changes: 0 additions & 27 deletions Documentation/Ctrl/Properties/AdminOnly.rst

This file was deleted.

Loading