You are here

public function FieldComparatorDefault::hasChanged in Conflict 8.2

Checks whether the field items have changed.

Parameters

\Drupal\Core\Field\FieldItemListInterface $field_item_list_a: A field item list.

\Drupal\Core\Field\FieldItemListInterface $field_item_list_b: Another field item list.

string $langcode: (optional) The language code of the entity translation being checked.

string $entity_type_id: (optional) The entity type ID.

string $bundle: (optional) The entity bundle.

string $field_type: (optional) The field type.

string $field_name: (optional) The field name.

Return value

bool|null TRUE, if both field item lists are equal, FALSE otherwise. NULL can be returned if this comparator cannot make a decision and the next one should be called.

Overrides FieldComparatorInterface::hasChanged

1 call to FieldComparatorDefault::hasChanged()
FieldComparatorDefault::getConflictType in src/Plugin/Conflict/FieldComparator/FieldComparatorDefault.php
Returns the conflict type for a field.

File

src/Plugin/Conflict/FieldComparator/FieldComparatorDefault.php, line 27

Class

FieldComparatorDefault
Default field comparator plugin implementation covering all fields.

Namespace

Drupal\conflict\Plugin\Conflict\FieldComparator

Code

public function hasChanged(FieldItemListInterface $field_item_list_a, FieldItemListInterface $field_item_list_b, $langcode = NULL, $entity_type_id = NULL, $bundle = NULL, $field_type = NULL, $field_name = NULL) {
  $equals = $field_item_list_a
    ->equals($field_item_list_b);
  return !$equals;
}