Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
22 changes: 22 additions & 0 deletions docs/channels/emails.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,28 @@

The date outputs in a human-readable format, configured in the settings in your Global Configuration > System Settings under 'Default format for date only' and 'Default time only format'.

Label modifier for select and boolean fields
---------------------------------------------

For select and boolean field types, you can display the human-readable label instead of the stored value by using the ``|label`` modifier:

.. code-block:: php

{contactfield=select_alias|label}
{contactfield=bool_alias|label}

This is useful when your select fields store technical values but you want to display user-friendly labels in your Emails. For example:

Check warning on line 154 in docs/channels/emails.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'User' instead of 'user'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'User' instead of 'user'.", "location": {"path": "docs/channels/emails.rst", "range": {"start": {"line": 154, "column": 87}}}, "severity": "INFO"}

- A country select field storing ``us`` can display ``United States``
- A boolean field storing ``1`` can display ``Yes``

The modifier also works with company fields:

Check warning on line 159 in docs/channels/emails.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Company' instead of 'company'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Company' instead of 'company'.", "location": {"path": "docs/channels/emails.rst", "range": {"start": {"line": 159, "column": 30}}}, "severity": "INFO"}

.. code-block:: php

{contactfield=company_select_alias|label}
{contactfield=company_bool_alias|label}

Contact replies
===============

Expand Down
34 changes: 34 additions & 0 deletions docs/configuration/variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,40 @@

``Hi {contactfield=firstname|there},``

Token modifiers
***************

Label modifier for select and boolean fields
=============================================

For select and boolean type fields, you can use the ``|label`` modifier to display the human-readable label instead of the stored value. This is particularly useful when your select fields store values like codes or IDs but you want to display friendly labels to your Contacts.

**Syntax:**

.. code-block:: text

{contactfield=field_alias|label}

**Examples:**

For a select field with alias ``country_select`` that has options like ``us`` (United States), ``uk`` (United Kingdom):

Check warning on line 27 in docs/configuration/variables.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/configuration/variables.rst", "range": {"start": {"line": 27, "column": 1}}}, "severity": "INFO"}

- ``{contactfield=country_select}`` - displays the value: ``us``
- ``{contactfield=country_select|label}`` - displays the label: ``United States``

For a boolean field with alias ``is_subscriber``:

- ``{contactfield=is_subscriber}`` - displays the value: ``1`` or ``0``
- ``{contactfield=is_subscriber|label}`` - displays the label: ``Yes`` or ``No``

This modifier works for both Contact fields and Company fields:

- ``{contactfield=company_type|label}`` - displays the label of a company select field

Check warning on line 39 in docs/configuration/variables.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Company' instead of 'company'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Company' instead of 'company'.", "location": {"path": "docs/configuration/variables.rst", "range": {"start": {"line": 39, "column": 19}}}, "severity": "INFO"}
- ``{contactfield=company_active|label}`` - displays the label of a company boolean field

Check warning on line 40 in docs/configuration/variables.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Company' instead of 'company'. Raw Output: {"message": "[Mautic.FeatureList] Is this referring to a Mautic feature? If so, use 'Company' instead of 'company'.", "location": {"path": "docs/configuration/variables.rst", "range": {"start": {"line": 40, "column": 19}}}, "severity": "INFO"}

.. note::
The ``|label`` modifier only works with select and boolean field types. For other field types, it will display the regular value.

Check warning on line 43 in docs/configuration/variables.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/configuration/variables.rst", "range": {"start": {"line": 43, "column": 103}}}, "severity": "WARNING"}

Contact fields
**************

Expand Down
Loading