You are here

public function ChangedFieldItemList::hasAffectingChanges in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/ChangedFieldItemList.php \Drupal\Core\Field\ChangedFieldItemList::hasAffectingChanges()

Determines whether the field has relevant changes.

This is for example used to determine if a revision of an entity has changes in a given translation. Unlike \Drupal\Core\Field\FieldItemListInterface::equals(), this can report that for example an untranslatable field, despite being changed and therefore technically affecting all translations, is only internal metadata or only affects a single translation.

Parameters

\Drupal\Core\Field\FieldItemListInterface $original_items: The original field items to compare against.

string $langcode: The language that should be checked.

Return value

bool TRUE if the field has relevant changes, FALSE if not.

Overrides FieldItemList::hasAffectingChanges

File

core/lib/Drupal/Core/Field/ChangedFieldItemList.php, line 24

Class

ChangedFieldItemList
Defines a item list class for changed fields.

Namespace

Drupal\Core\Field

Code

public function hasAffectingChanges(FieldItemListInterface $original_items, $langcode) {

  // When saving entities in the user interface, the changed timestamp is
  // automatically incremented by ContentEntityForm::submitForm() even if
  // nothing was actually changed. Thus, the changed time needs to be
  // ignored when determining whether there are any actual changes in the
  // entity.
  return FALSE;
}