drupal-eca-recipe/eca_lib_0018

Keep 2 fields in sync

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Type:drupal-recipe

3.1.0 2025-08-01 15:01 UTC

This package is auto-updated.

Last update: 2025-08-01 15:03:28 UTC


README

ID: eca_lib_0018

This model demonstrates how a text field in a user entity can be kept in sync with a similar field in an associated profile entity. This works in both directions. Regardless which of the entities gets updated, the other one will be updated automatically as well.

Without paying attention, this could lead into an infinite loop. Therefore, the related entity only gets updated if the field values are not the same already.

The creation of that model has been recorded: Watch the video

Installation

## Import recipe
composer require drupal/eca_lib_0018

# Apply recipe with Drush (requires version 13 or later):
drush recipe ../recipes/{{ rawid }}

# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0018

# Rebuilding caches is optional, sometimes required:
drush cr