Skip to content

Access to form fields with tokens

Version v1

Instead of downloading the archive, you can download and apply this model as a recipe (Drupal 10.3 or later):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Import recipe
composer require drupal-eca-recipe/eca_lib_0028

# Enable recipe with Drush (requires version 13 or later):
drush recipe ../recipes/eca_lib_0028

# Enable recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0028

# Rebuilding caches is optional, sometimes required:
drush cr

Purpose

This model demonstrates how to access form field values during validation or submission, how to find out the proper token syntax for each form field type, and also an alternative approach by building a temporary entity from form field values to use the more transparent entity token syntax.

The creation of this module was recorded and the video with additional explanations can be watch here.

Dependencies

  • config
    • field.field.node.article.field_flag
    • field.field.node.article.field_text
    • field.field.node.location.field_flag
    • field.field.node.location.field_text
    • field.storage.node.field_flag
    • field.storage.node.field_text
    • node.type.article
    • node.type.location
  • module
    • eca_form
    • menu_ui
    • node

Used plugins

Events

Actions

Changelog

v1

Initial version