Obsolete

This module is Obsolete as of Drupal 11 due to #2329253: Allow ChangedItem to skip updating the entity's "changed" timestamp when synchronizing

Description

There's no easy way to prevent the fields of type changed to be updated when the host entity is updating. There are business cases when you don't want this field to be refreshed on an entity save. A Drupal core issue is already dealing with this problem but it's not yet committed. This module covers this lack of API and will be dropped as soon the core issue is fixed.

How to use it?

When saving an existing entity that has a changed field type, mark the field
to be preserved during the save:

$node = Node::load(123);
// Change the title.
$node->title->value = 'New title';
// Mark the 'changed' field to be preserved.
$node->changed->preserve = TRUE;
$node->save();

Project information

Releases