Skip to content

Commit

Permalink
[TASK] Introduce confval menues for processor options (#1359)
Browse files Browse the repository at this point in the history
Releases: main, 13.4, 12.4

Co-authored-by: lina.wolf <lwolf@w-commerce.de>
  • Loading branch information
github-actions[bot] and linawolf committed Oct 21, 2024
1 parent d2a0a97 commit 461ba25
Show file tree
Hide file tree
Showing 10 changed files with 549 additions and 729 deletions.
127 changes: 54 additions & 73 deletions Documentation/DataProcessing/CommaSeparatedValueProcessor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,93 +19,81 @@ two-dimensional array used for :abbr:`CSV (Comma-separated values)` files or
The table data is transformed to a multi-dimensional array, taking the delimiter
and enclosure into account, before it is passed to the view.

.. contents:: Table of contents

.. _CommaSeparatedValueProcessor-options:

Options:
========

.. _CommaSeparatedValueProcessor-if:

if
--

.. confval:: if
:name: CommaSeparatedValueProcessor-if
:Required: false
:type: :ref:`if` condition
:Default: ''

If the condition is met, the data processor is processed.

.. _CommaSeparatedValueProcessor-fieldName:
.. confval-menu::
:display: table
:type:
:Default:

fieldName
---------
.. _CommaSeparatedValueProcessor-if:

.. confval:: fieldName
:name: CommaSeparatedValueProcessor-fieldName
:Required: true
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: ''
.. confval:: if
:name: CommaSeparatedValueProcessor-if
:Required: false
:type: :ref:`if` condition
:Default: ''

Name of the field in the processed ContentObjectRenderer.
If the condition is met, the data processor is processed.

.. _CommaSeparatedValueProcessor-fieldName:

.. _CommaSeparatedValueProcessor-as:
.. confval:: fieldName
:name: CommaSeparatedValueProcessor-fieldName
:Required: true
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: ''

as
--
Name of the field in the processed ContentObjectRenderer.

.. confval:: as
:name: CommaSeparatedValueProcessor-as
:Required: false
:type: :ref:`data-type-string`
:Default: defaults to the fieldName

The variable's name to be used in the Fluid template.
.. _CommaSeparatedValueProcessor-as:

.. _CommaSeparatedValueProcessor-maximumColumns:
.. confval:: as
:name: CommaSeparatedValueProcessor-as
:Required: false
:type: :ref:`data-type-string`
:Default: defaults to the fieldName

maximumColumns
--------------
The variable's name to be used in the Fluid template.

.. confval:: maximumColumns
:name: CommaSeparatedValueProcessor-maximumColumns
:Required: false
:type: :ref:`data-type-integer` / :ref:`stdWrap`
:Default: :typoscript:`0`
.. _CommaSeparatedValueProcessor-maximumColumns:

Maximal number of columns to be transformed. Surplus columns will be
silently dropped. When set to :typoscript:`0` (default) all columns will be
transformed.
.. confval:: maximumColumns
:name: CommaSeparatedValueProcessor-maximumColumns
:Required: false
:type: :ref:`data-type-integer` / :ref:`stdWrap`
:Default: :typoscript:`0`

Maximal number of columns to be transformed. Surplus columns will be
silently dropped. When set to :typoscript:`0` (default) all columns will be
transformed.

.. _CommaSeparatedValueProcessor-fieldDelimiter:
.. _CommaSeparatedValueProcessor-fieldDelimiter:

fieldDelimiter
--------------
.. confval:: fieldDelimiter
:name: CommaSeparatedValueProcessor-fieldDelimiter
:Required: false
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: :typoscript:`,`

.. confval:: fieldDelimiter
:name: CommaSeparatedValueProcessor-fieldDelimiter
:Required: false
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: :typoscript:`,`
The field delimiter, a character separating the values.

The field delimiter, a character separating the values.

.. _CommaSeparatedValueProcessor-fieldEnclosure:

.. _CommaSeparatedValueProcessor-fieldEnclosure:
.. confval:: fieldEnclosure
:name: CommaSeparatedValueProcessor-fieldEnclosure
:Required: false
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: :typoscript:`"`

fieldEnclosure
--------------

.. confval:: fieldEnclosure
:name: CommaSeparatedValueProcessor-fieldEnclosure
:Required: false
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: :typoscript:`"`

The field enclosure, a character surrounding the values.
The field enclosure, a character surrounding the values.

.. _CommaSeparatedValueProcessor-examples:

Expand All @@ -121,8 +109,7 @@ the values can be specified.
This example is also described in-depth in :ref:`TYPO3 Explained:
Extended content element example <t3coreapi:AddingCE-Extended-Example>`.

Example data in the field :php:`bodytext`
-----------------------------------------
.. rubric:: Example data in the field :php:`bodytext`

Field :sql:`bodytext` in table :sql:`tt_content`:

Expand All @@ -132,27 +119,21 @@ Field :sql:`bodytext` in table :sql:`tt_content`:
"This is row 2 column 1","This is row 2 column 2","This is row 2 column 3"
"This is row 3 column 1","This is row 3 column 2","This is row 3 column 3"
TypoScript
----------
.. rubric:: TypoScript

We define the :typoscript:`dataProcessing` property to use the
:php:`CommaSeparatedValueProcessor`:

.. include:: /CodeSnippets/DataProcessing/TypoScript/CommaSeparatedValueProcessor.rst.txt


The Fluid template
------------------
.. rubric:: The Fluid template

In the Fluid template, you can iterate over the processed data. "myContentTable" can
be used as a variable :html:`{myContentTable}` inside Fluid for iteration.

.. include:: /CodeSnippets/DataProcessing/Template/DataProcCsv.rst.txt


Output
------
.. rubric:: Output

Using :typoscript:`maximumColumns` limits the amount of columns in the multi dimensional array.
In this example, the field data of the last column will be stripped off. Therefore the output would be:
Expand Down
105 changes: 47 additions & 58 deletions Documentation/DataProcessing/DatabaseQueryProcessor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,75 +19,70 @@ standard TypoScript :ref:`select` semantics. The result is then passed to the
This way a :ref:`cobj-fluidtemplate` cObject can iterate over the
array of records.

.. contents:: Table of contents

.. _DatabaseQueryProcessor-options:

Options:
========

.. _DatabaseQueryProcessor-if:

if
--

.. confval:: if
:name: DatabaseQueryProcessor-if
:Required: false
:type: :ref:`if` condition
:Default: ''

Only if the condition is met the data processor is executed.
.. confval-menu::
:display: table
:type:
:Default:

.. _DatabaseQueryProcessor-if:

.. _DatabaseQueryProcessor-table:
.. confval:: if
:name: DatabaseQueryProcessor-if
:Required: false
:type: :ref:`if` condition
:Default: ''

table
-----
Only if the condition is met the data processor is executed.

.. confval:: table
:name: DatabaseQueryProcessor-table
:Required: true
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: ''

Name of the table from which the records should be fetched.
.. _DatabaseQueryProcessor-table:

.. _DatabaseQueryProcessor-as:
.. confval:: table
:name: DatabaseQueryProcessor-table
:Required: true
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: ''

as
--
Name of the table from which the records should be fetched.

.. confval:: as
:name: DatabaseQueryProcessor-as
:Required: false
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: 'records'
.. _DatabaseQueryProcessor-as:

The variable's name to be used in the Fluid template.
.. confval:: as
:name: DatabaseQueryProcessor-as
:Required: false
:type: :ref:`data-type-string` / :ref:`stdWrap`
:Default: 'records'

.. _DatabaseQueryProcessor-dataProcessing:
The variable's name to be used in the Fluid template.

dataProcessing
--------------
.. _DatabaseQueryProcessor-dataProcessing:

.. confval:: dataProcessing
:name: DatabaseQueryProcessor-dataProcessing
:Required: false
:type: array of :ref:`dataProcessing`
:Default: []
.. confval:: dataProcessing
:name: DatabaseQueryProcessor-dataProcessing
:Required: false
:type: array of :ref:`dataProcessing`
:Default: []

Array of data processors to be applied to all fetched records.
Array of data processors to be applied to all fetched records.

.. note::
All other options will be interpreted as in the TypoScript function
:typoscript:`select`, including :typoscript:`pidInList`,
:typoscript:`orderBy`, :typoscript:`where`, etc. See the reference of
:ref:`select`.
.. note::
All other options will be interpreted as in the TypoScript function
:typoscript:`select`, including :typoscript:`pidInList`,
:typoscript:`orderBy`, :typoscript:`where`, etc. See the reference of
:ref:`select`.

.. warning::
When using the DatabaseQueryProcessor, you may encounter issues with
language and/or versioning overlays, that currently can not be resolved.
See `here <https://forge.typo3.org/issues/85284#note-5>`__ for more
information.
.. warning::
When using the DatabaseQueryProcessor, you may encounter issues with
language and/or versioning overlays, that currently can not be resolved.
See `here <https://forge.typo3.org/issues/85284#note-5>`__ for more
information.

.. _DatabaseQueryProcessor-examples:

Expand All @@ -96,28 +91,22 @@ Example: Display haiku records

Please see also :ref:`dataProcessing-about-examples`.

TypoScript
----------
.. rubric:: TypoScript

We define the :typoscript:`dataProcessing` property to use the
:php:`DatabaseQueryProcessor`:

.. include:: /CodeSnippets/DataProcessing/TypoScript/DatabaseQueryProcessor.rst.txt



The Fluid template
------------------
.. rubric:: The Fluid template

In the Fluid template then iterate over the records. As we used the recursive
data processor :ref:`FilesProcessor` on the image records, we can also output
the images.

.. include:: /CodeSnippets/DataProcessing/Template/DataProcDb.rst.txt


Output
------
.. rubric:: Output

Each entry of the records array contains the data of the table in :php:`data`
and the data of the images in :php:`files`.
Expand Down
Loading

0 comments on commit 461ba25

Please sign in to comment.