You are here

public function FieldItemList::hasAffectingChanges in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/FieldItemList.php \Drupal\Core\Field\FieldItemList::hasAffectingChanges()
  2. 10 core/lib/Drupal/Core/Field/FieldItemList.php \Drupal\Core\Field\FieldItemList::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 FieldItemListInterface::hasAffectingChanges

1 method overrides FieldItemList::hasAffectingChanges()
ChangedFieldItemList::hasAffectingChanges in core/lib/Drupal/Core/Field/ChangedFieldItemList.php
Determines whether the field has relevant changes.

File

core/lib/Drupal/Core/Field/FieldItemList.php, line 417

Class

FieldItemList
Represents an entity field; that is, a list of field item objects.

Namespace

Drupal\Core\Field

Code

public function hasAffectingChanges(FieldItemListInterface $original_items, $langcode) {
  return !$this
    ->equals($original_items);
}