Skip to content

Commit

Permalink
[FEATURE] Feature: #97193 - New TCA type “number”
Browse files Browse the repository at this point in the history
  • Loading branch information
nhovratov committed Apr 6, 2022
1 parent e9847b9 commit e0c542c
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Example
'mode' => 'prepend'
'valuePicker' => [
'items' => [
['https://', 'HTTPS'],
['http://', 'HTTP'],
['HTTPS', 'https://'],
['HTTP', 'http://'],
],
],
],
Expand Down
8 changes: 4 additions & 4 deletions Documentation/ColumnsConfig/Type/Number/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ is done like following:
// Before
'int_field => [
'int_field' => [
'label' => 'Int field',
'config' => [
'type' => 'input',
Expand All @@ -46,7 +46,7 @@ is done like following:
// After
'int_field => [
'int_field' => [
'label' => 'Int field',
'config' => [
'type' => 'number',
Expand All @@ -63,7 +63,7 @@ is done like following:
// Before
'double2_field => [
'double2_field' => [
'label' => 'double2 field',
'config' => [
'type' => 'input',
Expand All @@ -73,7 +73,7 @@ is done like following:
// After
'double2_field => [
'double2_field' => [
'label' => 'double2 field',
'config' => [
'type' => 'number',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ autocomplete
:type: boolean
:Scope: Display

Controls the `autocomplete` attribute of a given email field. If set to true (default false),
adds attribute :php:`autocomplete="on"` to the email input field allowing browser auto filling the field:
Controls the `autocomplete` attribute of a given number field. If set to true (default false),
adds attribute :php:`autocomplete="on"` to the number input field allowing browser auto filling the field:

.. code-block:: php
:emphasize-lines: 7
'email' => [
'label' => 'number',
'integer_field' => [
'label' => 'Integer field',
'config' => [
'type' => 'number',
'size' => 20,
Expand Down
4 changes: 0 additions & 4 deletions Documentation/ColumnsConfig/Type/Number/Properties/Eval.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ eval

Configuration of field evaluation.

Some of these evaluation keywords will trigger a JavaScript pre- evaluation
in the form. Other evaluations will be performed in the backend. The
evaluation functions will be executed in the list-order.

Keywords:

null
Expand Down
4 changes: 4 additions & 0 deletions Documentation/ColumnsConfig/Type/Number/Properties/Format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ format
:Scope: Display

Keywords: :php:`integer`, :php:`decimal`

The format property defines, which type of number should be handled. The
:php:`integer` format is a simple number, whereas the :php:`decimal` format
is a float value with two decimal places.
5 changes: 0 additions & 5 deletions Documentation/ColumnsConfig/Type/Number/Properties/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,3 @@ Common properties
* :ref:`placeholder <tca_property_placeholder>`
* :ref:`readOnly <tca_property_readOnly>`
* :ref:`required <tca_property_required>`

.. note::

The softref definition :php:`softref=>email[subst]` is automatically applied
to all :php:`email` fields.
22 changes: 11 additions & 11 deletions Documentation/ColumnsConfig/Type/Number/Properties/Range.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
range
=====

.. confval:: range
.. confval:: range ('type' => 'number')

:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config']
:type: array
Expand All @@ -29,13 +29,13 @@ Limit an integer to be within the range 10 to 1000

.. code-block:: php
'aField' => [
'label' => 'aLabel',
'config' => [
'type' => 'number'
'range' => [
'lower' => 10,
'upper' => 1000
],
],
],
'aField' => [
'label' => 'aLabel',
'config' => [
'type' => 'number',
'range' => [
'lower' => 10,
'upper' => 1000
],
],
],
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ size
:type: integer
:Scope: Display

Abstract value for the width of the :code:`<input>` field. To set the email
Abstract value for the width of the :code:`<input>` field. To set the number
field to the full width of the form area, use the value 50. Minimum is 10.
Default is 30.
75 changes: 38 additions & 37 deletions Documentation/ColumnsConfig/Type/Number/Properties/Slider.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.. include:: /Includes.rst.txt
.. _columns-input-properties-slider:
.. _columns-number-properties-slider:

======
slider
======

.. confval:: slider ('type' => 'number')
.. confval:: slider

:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config']
:type: array
Expand All @@ -31,51 +32,51 @@ Integer slider between 0 and 100

.. code-block:: php
'aField' => [
'label' => 'percent',
'config' => [
'type' => 'number'
'range' => [
'lower' => 0,
'upper' => 100
],
'slider' => [
'step' => 1
]
],
],
'aField' => [
'label' => 'percent',
'config' => [
'type' => 'number',
'range' => [
'lower' => 0,
'upper' => 100
],
'slider' => [
'step' => 1
]
],
],
Integer slider between 0 and 10 000
-----------------------------------

.. code-block:: php
'aField' => [
'label' => 'percent',
'config' => [
'type' => 'number'
'slider' => [
'step' => 1
]
],
],
'aField' => [
'label' => 'percent',
'config' => [
'type' => 'number',
'slider' => [
'step' => 1
]
],
],
Decimal slider between 0 and 1
------------------------------

.. code-block:: php
'aField' => [
'label' => 'aLabel',
'config' => [
'type' => 'number'
'format' => 'decimal'
'range' => [
'lower' => 0,
'upper' => 1
],
'slider' => [
'step' => 0.1
]
],
],
'aField' => [
'label' => 'aLabel',
'config' => [
'type' => 'number',
'format' => 'decimal',
'range' => [
'lower' => 0,
'upper' => 1
],
'slider' => [
'step' => 0.1
]
],
],
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Example

.. code-block:: php
'input_33' => [
'label' => 'input_33',
'number_field' => [
'label' => 'Number field',
'config' => [
'type' => 'link',
'mode' => 'prepend'
'type' => 'number',
'mode' => ''
'valuePicker' => [
'items' => [
['https://', 'HTTPS'],
['http://', 'HTTP'],
['One', '1'],
['Two', '2'],
],
],
],
Expand Down

0 comments on commit e0c542c

Please sign in to comment.