From c57d30af258cfa8290ea58afd50fe584316be78b Mon Sep 17 00:00:00 2001 From: Webnet team Date: Fri, 13 Jul 2018 15:46:49 +0200 Subject: [PATCH 1/7] new translation_parameters form option --- reference/forms/types/button.rst | 3 + reference/forms/types/choice.rst | 3 + reference/forms/types/entity.rst | 3 + reference/forms/types/form.rst | 3 + .../button_translation_parameters.rst.inc | 54 ++++++++++++++++++ .../choice_type_translation_domain.rst.inc | 2 +- ...choice_type_translation_parameters.rst.inc | 56 +++++++++++++++++++ ...entity_type_translation_parameters.rst.inc | 56 +++++++++++++++++++ .../reset_translation_parameters.rst.inc | 54 ++++++++++++++++++ .../submit_translation_parameters.rst.inc | 54 ++++++++++++++++++ .../options/translation_parameters.rst.inc | 49 ++++++++++++++++ reference/forms/types/reset.rst | 3 + reference/forms/types/submit.rst | 3 + templating/PHP.rst | 2 +- 14 files changed, 343 insertions(+), 2 deletions(-) create mode 100644 reference/forms/types/options/button_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/choice_type_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/entity_type_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/reset_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/submit_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/translation_parameters.rst.inc diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index 8ecd99a8a7a..4d84f397267 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -13,6 +13,7 @@ A simple, non-responsive button. | options | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | +| | - `translation_parameters`_ | +----------------------+----------------------------------------------------------------------+ | Parent type | none | +----------------------+----------------------------------------------------------------------+ @@ -51,3 +52,5 @@ as a key. This can be useful when you need to set a custom class for the button: .. include:: /reference/forms/types/options/button_label.rst.inc .. include:: /reference/forms/types/options/button_translation_domain.rst.inc + +.. include:: /reference/forms/types/options/button_translation_parameters.rst.inc diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 13f0c0bdcdb..ad47316b948 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -45,6 +45,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op | | - `mapped`_ | | | - `required`_ | | | - `translation_domain`_ | +| | - `translation_parameters`_ | +-------------+------------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +-------------+------------------------------------------------------------------------------+ @@ -297,6 +298,8 @@ These options inherit from the :doc:`FormType `: .. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc +.. include:: /reference/forms/types/options/choice_type_translation_parameters.rst.inc + Field Variables --------------- diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 034e1cafb84..db645c3f9a8 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -32,6 +32,7 @@ objects from the database. | | - `placeholder`_ | | | - `preferred_choices`_ | | | - `translation_domain`_ | +| | - `translation_parameters`_ | | | - `trim`_ | | | | | | from the :doc:`FormType `: | @@ -307,6 +308,8 @@ when rendering the field: .. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc +.. include:: /reference/forms/types/options/entity_type_translation_parameters.rst.inc + .. include:: /reference/forms/types/options/choice_type_trim.rst.inc These options inherit from the :doc:`form ` diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index d31f75126ec..45e4d3c841b 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -42,6 +42,7 @@ on all types for which ``FormType`` is the parent. | | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | +| | - `translation_parameters`_ | +-----------+--------------------------------------------------------------------+ | Parent | none | +-----------+--------------------------------------------------------------------+ @@ -167,3 +168,5 @@ of the form type tree (i.e. it cannot be used as a form type on its own). .. include:: /reference/forms/types/options/label.rst.inc .. include:: /reference/forms/types/options/translation_domain.rst.inc + +.. include:: /reference/forms/types/options/translation_parameters.rst.inc diff --git a/reference/forms/types/options/button_translation_parameters.rst.inc b/reference/forms/types/options/button_translation_parameters.rst.inc new file mode 100644 index 00000000000..81c2a44838e --- /dev/null +++ b/reference/forms/types/options/button_translation_parameters.rst.inc @@ -0,0 +1,54 @@ +translation_parameters +~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_ can contain +:ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order_list.submit_to_company: Send an order to %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\ButtonType; + // ... + + $builder->add('send', ButtonType::class, array( + 'label' => 'form.order_list.submit_to_company', + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +Note that `translation_parameters` of buttons are merged with those of parent. +In other words the parent's parameters are available for buttons but can be +overriden: + +.. code-block:: php + + // App\Controller\OrderListController + + $form = $this->createForm(OrderListType::class, null, array( + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +.. code-block:: php + + // App\Form\OrderListType + use Symfony\Component\Form\Extension\Core\Type\ButtonType; + // ... + + $builder->add('send', ButtonType::class, array( + 'label' => 'form.order_list.submit_to_company', + )); diff --git a/reference/forms/types/options/choice_type_translation_domain.rst.inc b/reference/forms/types/options/choice_type_translation_domain.rst.inc index 87cd76cff9a..c22125ea844 100644 --- a/reference/forms/types/options/choice_type_translation_domain.rst.inc +++ b/reference/forms/types/options/choice_type_translation_domain.rst.inc @@ -5,4 +5,4 @@ translation_domain In case `choice_translation_domain`_ is set to ``true`` or ``null``, this configures the exact translation domain that will be used for any labels or -options that are rendered for this field +options that are rendered for this field. diff --git a/reference/forms/types/options/choice_type_translation_parameters.rst.inc b/reference/forms/types/options/choice_type_translation_parameters.rst.inc new file mode 100644 index 00000000000..6425dbca3c8 --- /dev/null +++ b/reference/forms/types/options/choice_type_translation_parameters.rst.inc @@ -0,0 +1,56 @@ +translation_parameters +~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_, `help`_ and some attr_ (``title``, ``placeholder``) can +contain :ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order_list.notify: Notify %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\ChoiceType; + // ... + + $builder->add('send', ChoiceType::class, array( + // ... + 'label' => 'form.order_list.notify', + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +Note that `translation_parameters` of choice fields are merged with those of parent. +In other words the parent's parameters are available for choice fields +but can be overriden: + +.. code-block:: php + + // App\Controller\OrderListController + + $form = $this->createForm(OrderListType::class, null, array( + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +.. code-block:: php + + // App\Form\OrderListType + use Symfony\Component\Form\Extension\Core\Type\ChoiceType; + // ... + + $builder->add('send', ChoiceType::class, array( + // ... + 'label' => 'form.order_list.notify', + )); diff --git a/reference/forms/types/options/entity_type_translation_parameters.rst.inc b/reference/forms/types/options/entity_type_translation_parameters.rst.inc new file mode 100644 index 00000000000..500a26dbce8 --- /dev/null +++ b/reference/forms/types/options/entity_type_translation_parameters.rst.inc @@ -0,0 +1,56 @@ +translation_parameters +~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_, `help`_ and some attr_ (``title``, ``placeholder``) can +contain :ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order_list.notify: Notify %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\EntityType; + // ... + + $builder->add('send', EntityType::class, array( + // ... + 'label' => 'form.order_list.notify', + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +Note that `translation_parameters` of entity fields are merged with those of parent. +In other words the parent's parameters are available for entity fields +but can be overriden: + +.. code-block:: php + + // App\Controller\OrderListController + + $form = $this->createForm(OrderListType::class, null, array( + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +.. code-block:: php + + // App\Form\OrderListType + use Symfony\Component\Form\Extension\Core\Type\EntityType; + // ... + + $builder->add('send', EntityType::class, array( + // ... + 'label' => 'form.order_list.notify', + )); diff --git a/reference/forms/types/options/reset_translation_parameters.rst.inc b/reference/forms/types/options/reset_translation_parameters.rst.inc new file mode 100644 index 00000000000..8aa588073ef --- /dev/null +++ b/reference/forms/types/options/reset_translation_parameters.rst.inc @@ -0,0 +1,54 @@ +translation_parameters +~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_ can contain +:ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order_list.submit_to_company: Send an order to %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\ResetType; + // ... + + $builder->add('send', ResetType::class, array( + 'label' => 'form.order_list.submit_to_company', + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +Note that `translation_parameters` of reset fields are merged with those of +parent form. In other words the parent's parameters are available for reset +fields but can be overriden: + +.. code-block:: php + + // App\Controller\OrderListController + + $form = $this->createForm(OrderListType::class, null, array( + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +.. code-block:: php + + // App\Form\OrderListType + use Symfony\Component\Form\Extension\Core\Type\ResetType; + // ... + + $builder->add('send', ResetType::class, array( + 'label' => 'form.order_list.submit_to_company', + )); diff --git a/reference/forms/types/options/submit_translation_parameters.rst.inc b/reference/forms/types/options/submit_translation_parameters.rst.inc new file mode 100644 index 00000000000..b6affc8253b --- /dev/null +++ b/reference/forms/types/options/submit_translation_parameters.rst.inc @@ -0,0 +1,54 @@ +translation_parameters +~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_ can contain +:ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order_list.submit_to_company: Send an order to %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\SubmitType; + // ... + + $builder->add('send', SubmitType::class, array( + 'label' => 'form.order_list.submit_to_company', + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +Note that `translation_parameters` of submit fields are merged with those of +parent. In other words the parent's parameters are available for submit fields +but can be overriden: + +.. code-block:: php + + // App\Controller\OrderListController + + $form = $this->createForm(OrderListType::class, null, array( + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +.. code-block:: php + + // App\Form\OrderListType + use Symfony\Component\Form\Extension\Core\Type\SubmitType; + // ... + + $builder->add('send', SubmitType::class, array( + 'label' => 'form.order_list.submit_to_company', + )); diff --git a/reference/forms/types/options/translation_parameters.rst.inc b/reference/forms/types/options/translation_parameters.rst.inc new file mode 100644 index 00000000000..86689515fe7 --- /dev/null +++ b/reference/forms/types/options/translation_parameters.rst.inc @@ -0,0 +1,49 @@ +translation_parameters +~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_, `help`_ and some attr_ (``title``, ``placeholder``) can +contain :ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order_list.id: Identifier of the order to %company% + +you can specify placeholder value: + +.. code-block:: php + + $builder->add('id', null, array( + 'label' => 'form.order_list.id', + 'translation_parameters' => [ + '%company%' => 'ACME Inc.' + ] + )); + +Note that `translation_parameters` of children fields are merged with those +of parent. In other words the parent's parameters are available for children +but can be overriden: + +.. code-block:: php + + // App\Controller\OrderListController + + $form = $this->createForm(OrderListType::class, null, array( + 'translation_parameters' => array( + '%company%' => 'ACME Inc.' + ) + )); + +.. code-block:: php + + // App\Form\OrderListType + + $builder->add('id', null, array( + 'label' => 'form.order_list.id' + )); diff --git a/reference/forms/types/reset.rst b/reference/forms/types/reset.rst index f9363b0257b..a73410a314c 100644 --- a/reference/forms/types/reset.rst +++ b/reference/forms/types/reset.rst @@ -13,6 +13,7 @@ A button that resets all fields to their original values. | options | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | +| | - `translation_parameters`_ | +----------------------+---------------------------------------------------------------------+ | Parent type | :doc:`ButtonType ` | +----------------------+---------------------------------------------------------------------+ @@ -45,3 +46,5 @@ as a key. This can be useful when you need to set a custom class for the button: .. include:: /reference/forms/types/options/button_label.rst.inc .. include:: /reference/forms/types/options/button_translation_domain.rst.inc + +.. include:: /reference/forms/types/options/reset_translation_parameters.rst.inc diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst index bdb7a92d12a..8a408f335f5 100644 --- a/reference/forms/types/submit.rst +++ b/reference/forms/types/submit.rst @@ -14,6 +14,7 @@ A submit button. | | - `label`_ | | | - `label_format`_ | | | - `translation_domain`_ | +| | - `translation_parameters`_ | | | - `validation_groups`_ | +----------------------+----------------------------------------------------------------------+ | Parent type | :doc:`ButtonType` | @@ -59,6 +60,8 @@ as a key. This can be useful when you need to set a custom class for the button: .. include:: /reference/forms/types/options/button_translation_domain.rst.inc +.. include:: /reference/forms/types/options/submit_translation_parameters.rst.inc + validation_groups ~~~~~~~~~~~~~~~~~ diff --git a/templating/PHP.rst b/templating/PHP.rst index 6e89a46964b..743082806f7 100644 --- a/templating/PHP.rst +++ b/templating/PHP.rst @@ -532,7 +532,7 @@ original template: humanize($name); } ?> - + From 32e79e10ada23b84f3dd4daa0f2cc92f85b7c17f Mon Sep 17 00:00:00 2001 From: Webnet team Date: Fri, 13 Jul 2018 16:00:09 +0200 Subject: [PATCH 2/7] correct link error --- .../types/options/entity_type_translation_parameters.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/options/entity_type_translation_parameters.rst.inc b/reference/forms/types/options/entity_type_translation_parameters.rst.inc index 500a26dbce8..71cd2cfcfba 100644 --- a/reference/forms/types/options/entity_type_translation_parameters.rst.inc +++ b/reference/forms/types/options/entity_type_translation_parameters.rst.inc @@ -3,7 +3,7 @@ translation_parameters **type**: ``array`` **default**: ``array()`` -Translated `label`_, `help`_ and some attr_ (``title``, ``placeholder``) can +Translated `label`_, `help`_ and some ``attr`` (``title``, ``placeholder``) can contain :ref:`placeholders `. This option allows you to pass an array of parameters in order to replace placeholders with actual values. From a6551061f053d6c61a61c7ffc67e9b9a691bbd1f Mon Sep 17 00:00:00 2001 From: Vladyslav Riabchenko Date: Tue, 12 Feb 2019 14:10:07 +0100 Subject: [PATCH 3/7] confirm with 28635 --- reference/forms/types/button.rst | 83 ++++++++++++++++++- reference/forms/types/choice.rst | 10 ++- reference/forms/types/entity.rst | 10 ++- reference/forms/types/form.rst | 9 +- .../attr_translation_parameters.rst.inc | 82 ++++++++++++++++++ .../button_translation_parameters.rst.inc | 54 ------------ ...choice_type_translation_parameters.rst.inc | 56 ------------- ...entity_type_translation_parameters.rst.inc | 56 ------------- .../help_translation_parameters.rst.inc | 72 ++++++++++++++++ .../label_translation_parameters.rst.inc | 72 ++++++++++++++++ .../reset_translation_parameters.rst.inc | 54 ------------ .../submit_translation_parameters.rst.inc | 54 ------------ .../options/translation_parameters.rst.inc | 49 ----------- reference/forms/types/reset.rst | 83 ++++++++++++++++++- reference/forms/types/submit.rst | 83 ++++++++++++++++++- 15 files changed, 493 insertions(+), 334 deletions(-) create mode 100644 reference/forms/types/options/attr_translation_parameters.rst.inc delete mode 100644 reference/forms/types/options/button_translation_parameters.rst.inc delete mode 100644 reference/forms/types/options/choice_type_translation_parameters.rst.inc delete mode 100644 reference/forms/types/options/entity_type_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/help_translation_parameters.rst.inc create mode 100644 reference/forms/types/options/label_translation_parameters.rst.inc delete mode 100644 reference/forms/types/options/reset_translation_parameters.rst.inc delete mode 100644 reference/forms/types/options/submit_translation_parameters.rst.inc delete mode 100644 reference/forms/types/options/translation_parameters.rst.inc diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index 4d84f397267..4f17fbf03ac 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -13,7 +13,8 @@ A simple, non-responsive button. | options | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | -| | - `translation_parameters`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | +----------------------+----------------------------------------------------------------------+ | Parent type | none | +----------------------+----------------------------------------------------------------------+ @@ -53,4 +54,82 @@ as a key. This can be useful when you need to set a custom class for the button: .. include:: /reference/forms/types/options/button_translation_domain.rst.inc -.. include:: /reference/forms/types/options/button_translation_parameters.rst.inc +label_translation_parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_ can contain +:ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order.submit_to_company: Send an order to %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\ButtonType; + // ... + + $builder->add('send', ButtonType::class, array( + 'label' => 'form.order.submit_to_company', + 'label_translation_parameters' => array( + '%company%' => 'ACME Inc.', + ), + )); + +Note that `label_translation_parameters` of buttons are merged with those of its +parent. In other words the parent's translation parameters are available for +children's buttons but can be overriden: + +.. code-block:: php + + // App/Controller/OrderController.php + use App\Form\OrderType; + // ... + + $form = $this->createForm(OrderType::class, $order, array( + // available to all children, grandchildren and so on. + 'label_translation_parameters' => array( + '%company%' => 'ACME', + ), + )); + +.. code-block:: php + + // App/Form/OrderType.php + use Symfony\Component\Form\Extension\Core\Type\ButtonType; + // ... + + $builder->add('send', ButtonType::class, array( + 'label' => 'form.order.submit_to_company', + // Value of parent's 'label_translation_parameters' will be merged with + // this field's empty 'label_translation_parameters'. + // array('%company%' => 'ACME') will be used to translate this label. + )); + +.. code-block:: php + + // App/Form/OrderType.php + use Symfony\Component\Form\Extension\Core\Type\ButtonType; + // ... + + $builder->add('send', ButtonType::class, array( + 'label' => 'form.order.submit_to_company', + 'label_translation_parameters' => array( + '%company%' => 'American Company Making Everything', + ), + // Value of parent's 'label_translation_parameters' will be merged with + // this button's 'label_translation_parameters'. + // array('%company%' => 'American Company Making Everything') + // will be used to translate this label. + )); + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index ad47316b948..aea19be951d 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -45,7 +45,9 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op | | - `mapped`_ | | | - `required`_ | | | - `translation_domain`_ | -| | - `translation_parameters`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | +| | - `helptranslation_parameters`_ | +-------------+------------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +-------------+------------------------------------------------------------------------------+ @@ -298,7 +300,11 @@ These options inherit from the :doc:`FormType `: .. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc -.. include:: /reference/forms/types/options/choice_type_translation_parameters.rst.inc +.. include:: /reference/forms/types/options/label_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/help_translation_parameters.rst.inc Field Variables --------------- diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index db645c3f9a8..cad2f8c64b6 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -32,7 +32,9 @@ objects from the database. | | - `placeholder`_ | | | - `preferred_choices`_ | | | - `translation_domain`_ | -| | - `translation_parameters`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | +| | - `help_translation_parameters`_ | | | - `trim`_ | | | | | | from the :doc:`FormType `: | @@ -308,7 +310,11 @@ when rendering the field: .. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc -.. include:: /reference/forms/types/options/entity_type_translation_parameters.rst.inc +.. include:: /reference/forms/types/options/label_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/help_translation_parameters.rst.inc .. include:: /reference/forms/types/options/choice_type_trim.rst.inc diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 45e4d3c841b..d8fe5f4c9c1 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -22,6 +22,7 @@ on all types for which ``FormType`` is the parent. | | - `help`_ | | | - `help_attr`_ | | | - `help_html`_ | +| | - `help_translation_parameters`_ | | | - `inherit_data`_ | | | - `invalid_message`_ | | | - `invalid_message_parameters`_ | @@ -42,6 +43,8 @@ on all types for which ``FormType`` is the parent. | | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | | | - `translation_parameters`_ | +-----------+--------------------------------------------------------------------+ | Parent | none | @@ -114,6 +117,8 @@ The actual default value of this option depends on other field options: .. include:: /reference/forms/types/options/help_html.rst.inc +.. include:: /reference/forms/types/options/help_translation_parameters.rst.inc + .. include:: /reference/forms/types/options/inherit_data.rst.inc .. include:: /reference/forms/types/options/invalid_message.rst.inc @@ -169,4 +174,6 @@ of the form type tree (i.e. it cannot be used as a form type on its own). .. include:: /reference/forms/types/options/translation_domain.rst.inc -.. include:: /reference/forms/types/options/translation_parameters.rst.inc +.. include:: /reference/forms/types/options/label_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc diff --git a/reference/forms/types/options/attr_translation_parameters.rst.inc b/reference/forms/types/options/attr_translation_parameters.rst.inc new file mode 100644 index 00000000000..362fd5f4820 --- /dev/null +++ b/reference/forms/types/options/attr_translation_parameters.rst.inc @@ -0,0 +1,82 @@ +attr_translation_parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Some translated `attr`_ (``title`` and ``placeholder``) can +contain :ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order.id.placeholder: Enter unique identifier of the order to %company% + form.order.id.title: This will be the reference in communications with %company% + +you can specify placeholder value: + +.. code-block:: php + + $builder->add('id', null, array( + 'attr' => array( + 'placeholder' => 'form.order.id.placeholder', + 'title' => 'form.order.id.title', + ), + 'attr_translation_parameters' => [ + '%company%' => 'ACME Inc.' + ] + )); + +Note that `attr_translation_parameters` of children fields are merged with those +of its parent. In other words the parent's translation parameters are available +for children but can be overriden: + +.. code-block:: php + + // App/Controller/OrderController.php + use App\Form\OrderType; + // ... + + $form = $this->createForm(OrderType::class, $order, array( + // available to all children, grandchildren and so on. + 'attr_translation_parameters' => array( + '%company%' => 'ACME', + ), + )); + + .. code-block:: php + + // App/Form/OrderType.php + // ... + + $builder->add('id', null, array( + 'attr' => array( + 'placeholder' => 'form.order.id.placeholder', + 'title' => 'form.order.id.title', + ), + // Value of parent's 'attr_translation_parameters' will be merged with + // this field's empty 'attr_translation_parameters'. + // array('%company%' => 'ACME') will be used to translate 'placeholder' and 'title'. + )); + + .. code-block:: php + + // App/Form/OrderType.php + // ... + + $builder->add('id', null, array( + 'attr' => array( + 'placeholder' => 'form.order.id.placeholder', + 'title' => 'form.order.id.title', + ), + 'attr_translation_parameters' => array( + '%company%' => 'American Company Making Everything', + ), + // Value of parent's 'attr_translation_parameters' will be merged with + // this field's 'attr_translation_parameters'. + // array('%company%' => 'American Company Making Everything') + // will be used to translate 'placeholder' and 'title'. + )); diff --git a/reference/forms/types/options/button_translation_parameters.rst.inc b/reference/forms/types/options/button_translation_parameters.rst.inc deleted file mode 100644 index 81c2a44838e..00000000000 --- a/reference/forms/types/options/button_translation_parameters.rst.inc +++ /dev/null @@ -1,54 +0,0 @@ -translation_parameters -~~~~~~~~~~~~~~~~~~~~~~ - -**type**: ``array`` **default**: ``array()`` - -Translated `label`_ can contain -:ref:`placeholders `. -This option allows you to pass an array of parameters in order to replace -placeholders with actual values. - -Given this translation message: - -.. code-block:: yaml - - # translations/messages.en.yml - form.order_list.submit_to_company: Send an order to %company% - -you can specify placeholder value: - -.. code-block:: php - - use Symfony\Component\Form\Extension\Core\Type\ButtonType; - // ... - - $builder->add('send', ButtonType::class, array( - 'label' => 'form.order_list.submit_to_company', - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -Note that `translation_parameters` of buttons are merged with those of parent. -In other words the parent's parameters are available for buttons but can be -overriden: - -.. code-block:: php - - // App\Controller\OrderListController - - $form = $this->createForm(OrderListType::class, null, array( - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -.. code-block:: php - - // App\Form\OrderListType - use Symfony\Component\Form\Extension\Core\Type\ButtonType; - // ... - - $builder->add('send', ButtonType::class, array( - 'label' => 'form.order_list.submit_to_company', - )); diff --git a/reference/forms/types/options/choice_type_translation_parameters.rst.inc b/reference/forms/types/options/choice_type_translation_parameters.rst.inc deleted file mode 100644 index 6425dbca3c8..00000000000 --- a/reference/forms/types/options/choice_type_translation_parameters.rst.inc +++ /dev/null @@ -1,56 +0,0 @@ -translation_parameters -~~~~~~~~~~~~~~~~~~~~~~ - -**type**: ``array`` **default**: ``array()`` - -Translated `label`_, `help`_ and some attr_ (``title``, ``placeholder``) can -contain :ref:`placeholders `. -This option allows you to pass an array of parameters in order to replace -placeholders with actual values. - -Given this translation message: - -.. code-block:: yaml - - # translations/messages.en.yml - form.order_list.notify: Notify %company% - -you can specify placeholder value: - -.. code-block:: php - - use Symfony\Component\Form\Extension\Core\Type\ChoiceType; - // ... - - $builder->add('send', ChoiceType::class, array( - // ... - 'label' => 'form.order_list.notify', - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -Note that `translation_parameters` of choice fields are merged with those of parent. -In other words the parent's parameters are available for choice fields -but can be overriden: - -.. code-block:: php - - // App\Controller\OrderListController - - $form = $this->createForm(OrderListType::class, null, array( - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -.. code-block:: php - - // App\Form\OrderListType - use Symfony\Component\Form\Extension\Core\Type\ChoiceType; - // ... - - $builder->add('send', ChoiceType::class, array( - // ... - 'label' => 'form.order_list.notify', - )); diff --git a/reference/forms/types/options/entity_type_translation_parameters.rst.inc b/reference/forms/types/options/entity_type_translation_parameters.rst.inc deleted file mode 100644 index 71cd2cfcfba..00000000000 --- a/reference/forms/types/options/entity_type_translation_parameters.rst.inc +++ /dev/null @@ -1,56 +0,0 @@ -translation_parameters -~~~~~~~~~~~~~~~~~~~~~~ - -**type**: ``array`` **default**: ``array()`` - -Translated `label`_, `help`_ and some ``attr`` (``title``, ``placeholder``) can -contain :ref:`placeholders `. -This option allows you to pass an array of parameters in order to replace -placeholders with actual values. - -Given this translation message: - -.. code-block:: yaml - - # translations/messages.en.yml - form.order_list.notify: Notify %company% - -you can specify placeholder value: - -.. code-block:: php - - use Symfony\Component\Form\Extension\Core\Type\EntityType; - // ... - - $builder->add('send', EntityType::class, array( - // ... - 'label' => 'form.order_list.notify', - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -Note that `translation_parameters` of entity fields are merged with those of parent. -In other words the parent's parameters are available for entity fields -but can be overriden: - -.. code-block:: php - - // App\Controller\OrderListController - - $form = $this->createForm(OrderListType::class, null, array( - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -.. code-block:: php - - // App\Form\OrderListType - use Symfony\Component\Form\Extension\Core\Type\EntityType; - // ... - - $builder->add('send', EntityType::class, array( - // ... - 'label' => 'form.order_list.notify', - )); diff --git a/reference/forms/types/options/help_translation_parameters.rst.inc b/reference/forms/types/options/help_translation_parameters.rst.inc new file mode 100644 index 00000000000..cd0755c0cde --- /dev/null +++ b/reference/forms/types/options/help_translation_parameters.rst.inc @@ -0,0 +1,72 @@ +help_translation_parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `help`_ can +contain :ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order.id.help: This will be the reference in communications with %company% + +you can specify placeholder value: + +.. code-block:: php + + $builder->add('id', null, array( + 'help' => 'form.order.id.help', + 'help_translation_parameters' => [ + '%company%' => 'ACME Inc.' + ] + )); + +Note that `help_translation_parameters` of children fields are merged with those +of its parent. In other words the parent's translation parameters are available +for children but can be overriden: + +.. code-block:: php + + // App/Controller/OrderController.php + use App\Form\OrderType; + // ... + + $form = $this->createForm(OrderType::class, $order, array( + // available to all children, grandchildren and so on. + 'help_translation_parameters' => array( + '%company%' => 'ACME', + ), + )); + + .. code-block:: php + + // App/Form/OrderType.php + // ... + + $builder->add('id', null, array( + 'help' => 'form.order.id.help', + // Value of parent's 'help_translation_parameters' will be merged with + // this field's empty 'help_translation_parameters'. + // array('%company%' => 'ACME') will be used to translate 'help'. + )); + + .. code-block:: php + + // App/Form/OrderType.php + // ... + + $builder->add('id', null, array( + 'help' => 'form.order.id.help', + 'help_translation_parameters' => array( + '%company%' => 'American Company Making Everything', + ), + // Value of parent's 'help_translation_parameters' will be merged with + // this field's 'help_translation_parameters'. + // array('%company%' => 'American Company Making Everything') + // will be used to translate 'help'. + )); diff --git a/reference/forms/types/options/label_translation_parameters.rst.inc b/reference/forms/types/options/label_translation_parameters.rst.inc new file mode 100644 index 00000000000..aec761841ce --- /dev/null +++ b/reference/forms/types/options/label_translation_parameters.rst.inc @@ -0,0 +1,72 @@ +label_translation_parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_, can +contain :ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order.id: Identifier of the order to %company% + +you can specify placeholder value: + +.. code-block:: php + + $builder->add('id', null, array( + 'label' => 'form.order.id', + 'label_translation_parameters' => [ + '%company%' => 'ACME Inc.' + ] + )); + +Note that `label_translation_parameters` of children fields are merged with those +of its parent. In other words the parent's translation parameters are available +for children but can be overriden: + +.. code-block:: php + + // App/Controller/OrderController.php + use App\Form\OrderType; + // ... + + $form = $this->createForm(OrderType::class, $order, array( + // available to all children, grandchildren and so on. + 'label_translation_parameters' => array( + '%company%' => 'ACME', + ), + )); + + .. code-block:: php + + // App/Form/OrderType.php + // ... + + $builder->add('id', null, array( + 'label' => 'form.order.id', + // Value of parent's 'label_translation_parameters' will be merged with + // this field's empty 'label_translation_parameters'. + // array('%company%' => 'ACME') will be used to translate this label. + )); + + .. code-block:: php + + // App/Form/OrderType.php + // ... + + $builder->add('id', null, array( + 'label' => 'form.order.id', + 'label_translation_parameters' => array( + '%company%' => 'American Company Making Everything', + ), + // Value of parent's 'label_translation_parameters' will be merged with + // this field's 'label_translation_parameters'. + // array('%company%' => 'American Company Making Everything') + // will be used to translate this label. + )); diff --git a/reference/forms/types/options/reset_translation_parameters.rst.inc b/reference/forms/types/options/reset_translation_parameters.rst.inc deleted file mode 100644 index 8aa588073ef..00000000000 --- a/reference/forms/types/options/reset_translation_parameters.rst.inc +++ /dev/null @@ -1,54 +0,0 @@ -translation_parameters -~~~~~~~~~~~~~~~~~~~~~~ - -**type**: ``array`` **default**: ``array()`` - -Translated `label`_ can contain -:ref:`placeholders `. -This option allows you to pass an array of parameters in order to replace -placeholders with actual values. - -Given this translation message: - -.. code-block:: yaml - - # translations/messages.en.yml - form.order_list.submit_to_company: Send an order to %company% - -you can specify placeholder value: - -.. code-block:: php - - use Symfony\Component\Form\Extension\Core\Type\ResetType; - // ... - - $builder->add('send', ResetType::class, array( - 'label' => 'form.order_list.submit_to_company', - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -Note that `translation_parameters` of reset fields are merged with those of -parent form. In other words the parent's parameters are available for reset -fields but can be overriden: - -.. code-block:: php - - // App\Controller\OrderListController - - $form = $this->createForm(OrderListType::class, null, array( - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -.. code-block:: php - - // App\Form\OrderListType - use Symfony\Component\Form\Extension\Core\Type\ResetType; - // ... - - $builder->add('send', ResetType::class, array( - 'label' => 'form.order_list.submit_to_company', - )); diff --git a/reference/forms/types/options/submit_translation_parameters.rst.inc b/reference/forms/types/options/submit_translation_parameters.rst.inc deleted file mode 100644 index b6affc8253b..00000000000 --- a/reference/forms/types/options/submit_translation_parameters.rst.inc +++ /dev/null @@ -1,54 +0,0 @@ -translation_parameters -~~~~~~~~~~~~~~~~~~~~~~ - -**type**: ``array`` **default**: ``array()`` - -Translated `label`_ can contain -:ref:`placeholders `. -This option allows you to pass an array of parameters in order to replace -placeholders with actual values. - -Given this translation message: - -.. code-block:: yaml - - # translations/messages.en.yml - form.order_list.submit_to_company: Send an order to %company% - -you can specify placeholder value: - -.. code-block:: php - - use Symfony\Component\Form\Extension\Core\Type\SubmitType; - // ... - - $builder->add('send', SubmitType::class, array( - 'label' => 'form.order_list.submit_to_company', - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -Note that `translation_parameters` of submit fields are merged with those of -parent. In other words the parent's parameters are available for submit fields -but can be overriden: - -.. code-block:: php - - // App\Controller\OrderListController - - $form = $this->createForm(OrderListType::class, null, array( - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -.. code-block:: php - - // App\Form\OrderListType - use Symfony\Component\Form\Extension\Core\Type\SubmitType; - // ... - - $builder->add('send', SubmitType::class, array( - 'label' => 'form.order_list.submit_to_company', - )); diff --git a/reference/forms/types/options/translation_parameters.rst.inc b/reference/forms/types/options/translation_parameters.rst.inc deleted file mode 100644 index 86689515fe7..00000000000 --- a/reference/forms/types/options/translation_parameters.rst.inc +++ /dev/null @@ -1,49 +0,0 @@ -translation_parameters -~~~~~~~~~~~~~~~~~~~~~~ - -**type**: ``array`` **default**: ``array()`` - -Translated `label`_, `help`_ and some attr_ (``title``, ``placeholder``) can -contain :ref:`placeholders `. -This option allows you to pass an array of parameters in order to replace -placeholders with actual values. - -Given this translation message: - -.. code-block:: yaml - - # translations/messages.en.yml - form.order_list.id: Identifier of the order to %company% - -you can specify placeholder value: - -.. code-block:: php - - $builder->add('id', null, array( - 'label' => 'form.order_list.id', - 'translation_parameters' => [ - '%company%' => 'ACME Inc.' - ] - )); - -Note that `translation_parameters` of children fields are merged with those -of parent. In other words the parent's parameters are available for children -but can be overriden: - -.. code-block:: php - - // App\Controller\OrderListController - - $form = $this->createForm(OrderListType::class, null, array( - 'translation_parameters' => array( - '%company%' => 'ACME Inc.' - ) - )); - -.. code-block:: php - - // App\Form\OrderListType - - $builder->add('id', null, array( - 'label' => 'form.order_list.id' - )); diff --git a/reference/forms/types/reset.rst b/reference/forms/types/reset.rst index a73410a314c..394e113cd82 100644 --- a/reference/forms/types/reset.rst +++ b/reference/forms/types/reset.rst @@ -13,7 +13,8 @@ A button that resets all fields to their original values. | options | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | -| | - `translation_parameters`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | +----------------------+---------------------------------------------------------------------+ | Parent type | :doc:`ButtonType ` | +----------------------+---------------------------------------------------------------------+ @@ -47,4 +48,82 @@ as a key. This can be useful when you need to set a custom class for the button: .. include:: /reference/forms/types/options/button_translation_domain.rst.inc -.. include:: /reference/forms/types/options/reset_translation_parameters.rst.inc +label_translation_parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_ can contain +:ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order.reset: Reset an order to %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\ResetType; + // ... + + $builder->add('send', ResetType::class, array( + 'label' => 'form.order.reset', + 'label_translation_parameters' => array( + '%company%' => 'ACME Inc.', + ), + )); + +Note that `label_translation_parameters` of resets are merged with those of its +parent. In other words the parent's translation parameters are available for +children's resets but can be overriden: + +.. code-block:: php + + // App/Controller/OrderController.php + use App\Form\OrderType; + // ... + + $form = $this->createForm(OrderType::class, $order, array( + // available to all children, grandchildren and so on. + 'label_translation_parameters' => array( + '%company%' => 'ACME', + ), + )); + +.. code-block:: php + + // App/Form/OrderType.php + use Symfony\Component\Form\Extension\Core\Type\ResetType; + // ... + + $builder->add('send', ResetType::class, array( + 'label' => 'form.order.reset', + // Value of parent's 'label_translation_parameters' will be merged with + // this field's empty 'label_translation_parameters'. + // array('%company%' => 'ACME') will be used to translate this label. + )); + +.. code-block:: php + + // App/Form/OrderType.php + use Symfony\Component\Form\Extension\Core\Type\ResetType; + // ... + + $builder->add('send', ResetType::class, array( + 'label' => 'form.order.reset', + 'label_translation_parameters' => array( + '%company%' => 'American Company Making Everything', + ), + // Value of parent's 'label_translation_parameters' will be merged with + // this reset's 'label_translation_parameters'. + // array('%company%' => 'American Company Making Everything') + // will be passed to translate this label. + )); + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst index 8a408f335f5..3c2b741280e 100644 --- a/reference/forms/types/submit.rst +++ b/reference/forms/types/submit.rst @@ -14,7 +14,8 @@ A submit button. | | - `label`_ | | | - `label_format`_ | | | - `translation_domain`_ | -| | - `translation_parameters`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | | | - `validation_groups`_ | +----------------------+----------------------------------------------------------------------+ | Parent type | :doc:`ButtonType` | @@ -60,7 +61,85 @@ as a key. This can be useful when you need to set a custom class for the button: .. include:: /reference/forms/types/options/button_translation_domain.rst.inc -.. include:: /reference/forms/types/options/submit_translation_parameters.rst.inc +label_translation_parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``array`` **default**: ``array()`` + +Translated `label`_ can contain +:ref:`placeholders `. +This option allows you to pass an array of parameters in order to replace +placeholders with actual values. + +Given this translation message: + +.. code-block:: yaml + + # translations/messages.en.yml + form.order.submit_to_company: Send an order to %company% + +you can specify placeholder value: + +.. code-block:: php + + use Symfony\Component\Form\Extension\Core\Type\SubmitType; + // ... + + $builder->add('send', SubmitType::class, array( + 'label' => 'form.order.submit_to_company', + 'label_translation_parameters' => array( + '%company%' => 'ACME Inc.', + ), + )); + +Note that `label_translation_parameters` of submits are merged with those of its +parent. In other words the parent's translation parameters are available for +children's submits but can be overriden: + +.. code-block:: php + + // App/Controller/OrderController.php + use App\Form\OrderType; + // ... + + $form = $this->createForm(OrderType::class, $order, array( + // available to all children, grandchildren and so on. + 'label_translation_parameters' => array( + '%company%' => 'ACME', + ), + )); + +.. code-block:: php + + // App/Form/OrderType.php + use Symfony\Component\Form\Extension\Core\Type\SubmitType; + // ... + + $builder->add('send', SubmitType::class, array( + 'label' => 'form.order.submit_to_company', + // Value of parent's 'label_translation_parameters' will be merged with + // this field's empty 'label_translation_parameters'. + // array('%company%' => 'ACME') will be used to translate this label. + )); + +.. code-block:: php + + // App/Form/OrderType.php + use Symfony\Component\Form\Extension\Core\Type\SubmitType; + // ... + + $builder->add('send', SubmitType::class, array( + 'label' => 'form.order.submit_to_company', + 'label_translation_parameters' => array( + '%company%' => 'American Company Making Everything', + ), + // Value of parent's 'label_translation_parameters' will be merged with + // this submit's 'label_translation_parameters'. + // array('%company%' => 'American Company Making Everything') + // will be passed to translate this label. + )); + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc validation_groups ~~~~~~~~~~~~~~~~~ From 71fc7ce1eaeff78f3897a3a76e832a12304858b8 Mon Sep 17 00:00:00 2001 From: Vladyslav Riabchenko Date: Tue, 12 Feb 2019 14:23:50 +0100 Subject: [PATCH 4/7] typo in form_translation_parameters docs --- reference/forms/types/choice.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index aea19be951d..8ef9984c8ca 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -47,7 +47,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op | | - `translation_domain`_ | | | - `label_translation_parameters`_ | | | - `attr_translation_parameters`_ | -| | - `helptranslation_parameters`_ | +| | - `help_translation_parameters`_ | +-------------+------------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +-------------+------------------------------------------------------------------------------+ From d7e7b0b22cc7f5cc24d5d5ccadef32d79aa5ca32 Mon Sep 17 00:00:00 2001 From: Vladyslav Riabchenko Date: Tue, 12 Feb 2019 16:19:01 +0100 Subject: [PATCH 5/7] correct attr link in entity type doc --- reference/forms/types/entity.rst | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index cad2f8c64b6..af1e934dd61 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -32,13 +32,11 @@ objects from the database. | | - `placeholder`_ | | | - `preferred_choices`_ | | | - `translation_domain`_ | -| | - `label_translation_parameters`_ | -| | - `attr_translation_parameters`_ | -| | - `help_translation_parameters`_ | | | - `trim`_ | | | | | | from the :doc:`FormType `: | | | | +| | - `attr`_ | | | - `data`_ | | | - `disabled`_ | | | - `empty_data`_ | @@ -52,6 +50,9 @@ objects from the database. | | - `label_format`_ | | | - `mapped`_ | | | - `required`_ | +| | - `label_translation_parameters`_ | +| | - `attr_translation_parameters`_ | +| | - `help_translation_parameters`_ | +-------------+------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +-------------+------------------------------------------------------------------+ @@ -310,17 +311,13 @@ when rendering the field: .. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc -.. include:: /reference/forms/types/options/label_translation_parameters.rst.inc - -.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc - -.. include:: /reference/forms/types/options/help_translation_parameters.rst.inc - .. include:: /reference/forms/types/options/choice_type_trim.rst.inc These options inherit from the :doc:`form ` type: +.. include:: /reference/forms/types/options/attr.rst.inc + .. include:: /reference/forms/types/options/data.rst.inc .. include:: /reference/forms/types/options/disabled.rst.inc @@ -356,3 +353,9 @@ The actual default value of this option depends on other field options: .. include:: /reference/forms/types/options/mapped.rst.inc .. include:: /reference/forms/types/options/required.rst.inc + +.. include:: /reference/forms/types/options/label_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/attr_translation_parameters.rst.inc + +.. include:: /reference/forms/types/options/help_translation_parameters.rst.inc From 70f36aded8fdbfa3ff204a53733d586f9efce5b0 Mon Sep 17 00:00:00 2001 From: Vladyslav Riabchenko Date: Tue, 12 Feb 2019 16:57:23 +0100 Subject: [PATCH 6/7] correct bug --- reference/forms/types/form.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index d8fe5f4c9c1..9d38ab840cc 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -45,7 +45,6 @@ on all types for which ``FormType`` is the parent. | | - `translation_domain`_ | | | - `label_translation_parameters`_ | | | - `attr_translation_parameters`_ | -| | - `translation_parameters`_ | +-----------+--------------------------------------------------------------------+ | Parent | none | +-----------+--------------------------------------------------------------------+ From 20c6f5a991b806a03099033c6ae21c8e6b4c52c8 Mon Sep 17 00:00:00 2001 From: Vladyslav Riabchenko Date: Wed, 13 Feb 2019 10:46:09 +0100 Subject: [PATCH 7/7] correct arrays short syntax --- reference/forms/types/button.rst | 4 ++-- .../forms/types/options/attr_translation_parameters.rst.inc | 4 ++-- .../forms/types/options/help_translation_parameters.rst.inc | 4 ++-- .../forms/types/options/label_translation_parameters.rst.inc | 4 ++-- reference/forms/types/reset.rst | 4 ++-- reference/forms/types/submit.rst | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index 4f17fbf03ac..4d0459b489c 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -57,7 +57,7 @@ as a key. This can be useful when you need to set a custom class for the button: label_translation_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``array`` **default**: ``array()`` +**type**: ``array`` **default**: ``[]`` Translated `label`_ can contain :ref:`placeholders `. @@ -85,7 +85,7 @@ you can specify placeholder value: ), )); -Note that `label_translation_parameters` of buttons are merged with those of its +Note that ``label_translation_parameters`` of buttons are merged with those of its parent. In other words the parent's translation parameters are available for children's buttons but can be overriden: diff --git a/reference/forms/types/options/attr_translation_parameters.rst.inc b/reference/forms/types/options/attr_translation_parameters.rst.inc index 362fd5f4820..f23aee36ee2 100644 --- a/reference/forms/types/options/attr_translation_parameters.rst.inc +++ b/reference/forms/types/options/attr_translation_parameters.rst.inc @@ -1,7 +1,7 @@ attr_translation_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``array`` **default**: ``array()`` +**type**: ``array`` **default**: ``[]`` Some translated `attr`_ (``title`` and ``placeholder``) can contain :ref:`placeholders `. @@ -30,7 +30,7 @@ you can specify placeholder value: ] )); -Note that `attr_translation_parameters` of children fields are merged with those +Note that ``attr_translation_parameters`` of children fields are merged with those of its parent. In other words the parent's translation parameters are available for children but can be overriden: diff --git a/reference/forms/types/options/help_translation_parameters.rst.inc b/reference/forms/types/options/help_translation_parameters.rst.inc index cd0755c0cde..3a1138e9f1d 100644 --- a/reference/forms/types/options/help_translation_parameters.rst.inc +++ b/reference/forms/types/options/help_translation_parameters.rst.inc @@ -1,7 +1,7 @@ help_translation_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``array`` **default**: ``array()`` +**type**: ``array`` **default**: ``[]`` Translated `help`_ can contain :ref:`placeholders `. @@ -26,7 +26,7 @@ you can specify placeholder value: ] )); -Note that `help_translation_parameters` of children fields are merged with those +Note that ``help_translation_parameters`` of children fields are merged with those of its parent. In other words the parent's translation parameters are available for children but can be overriden: diff --git a/reference/forms/types/options/label_translation_parameters.rst.inc b/reference/forms/types/options/label_translation_parameters.rst.inc index aec761841ce..269b52ff72f 100644 --- a/reference/forms/types/options/label_translation_parameters.rst.inc +++ b/reference/forms/types/options/label_translation_parameters.rst.inc @@ -1,7 +1,7 @@ label_translation_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``array`` **default**: ``array()`` +**type**: ``array`` **default**: ``[]`` Translated `label`_, can contain :ref:`placeholders `. @@ -26,7 +26,7 @@ you can specify placeholder value: ] )); -Note that `label_translation_parameters` of children fields are merged with those +Note that ``label_translation_parameters`` of children fields are merged with those of its parent. In other words the parent's translation parameters are available for children but can be overriden: diff --git a/reference/forms/types/reset.rst b/reference/forms/types/reset.rst index 394e113cd82..b3d0e14db0a 100644 --- a/reference/forms/types/reset.rst +++ b/reference/forms/types/reset.rst @@ -51,7 +51,7 @@ as a key. This can be useful when you need to set a custom class for the button: label_translation_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``array`` **default**: ``array()`` +**type**: ``array`` **default**: ``[]`` Translated `label`_ can contain :ref:`placeholders `. @@ -79,7 +79,7 @@ you can specify placeholder value: ), )); -Note that `label_translation_parameters` of resets are merged with those of its +Note that ``label_translation_parameters`` of resets are merged with those of its parent. In other words the parent's translation parameters are available for children's resets but can be overriden: diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst index 3c2b741280e..541b2cbba77 100644 --- a/reference/forms/types/submit.rst +++ b/reference/forms/types/submit.rst @@ -64,7 +64,7 @@ as a key. This can be useful when you need to set a custom class for the button: label_translation_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``array`` **default**: ``array()`` +**type**: ``array`` **default**: ``[]`` Translated `label`_ can contain :ref:`placeholders `. @@ -92,7 +92,7 @@ you can specify placeholder value: ), )); -Note that `label_translation_parameters` of submits are merged with those of its +Note that ``label_translation_parameters`` of submits are merged with those of its parent. In other words the parent's translation parameters are available for children's submits but can be overriden: