Skip to content

Keep 2 fields in sync

Version v1

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

1
2
composer require drupal-eca-recipe/eca_lib_0018
cd web && php core/scripts/drupal recipe ../vendor/drupal-eca-recipe/eca_lib_0018

Purpose

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

Dependencies

  • config
    • field.field.profile.contact_detail.field_real_name
    • field.field.user.user.field_real_name
    • field.storage.profile.field_real_name
    • field.storage.user.field_real_name
    • profile.type.contact_detail
  • module
    • eca_base
    • eca_content
    • profile
    • user

Used plugins

Events

Conditions

Actions

Changelog

v1

Initial version