X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FField%2FFieldItemList.php;fp=web%2Fcore%2Flib%2FDrupal%2FCore%2FField%2FFieldItemList.php;h=c2e9ada44c5e0a300729dd539f2c31ea1eca2cb9;hp=a1a1ebdb9ebb12c02e3789471d6de1becb1c79ac;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/lib/Drupal/Core/Field/FieldItemList.php b/web/core/lib/Drupal/Core/Field/FieldItemList.php index a1a1ebdb9..c2e9ada44 100644 --- a/web/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/web/core/lib/Drupal/Core/Field/FieldItemList.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\Core\TypedData\Plugin\DataType\ItemList; /** @@ -378,7 +379,6 @@ class FieldItemList extends ItemList implements FieldItemListInterface { * {@inheritdoc} */ public function equals(FieldItemListInterface $list_to_compare) { - $columns = $this->getFieldDefinition()->getFieldStorageDefinition()->getColumns(); $count1 = count($this); $count2 = count($list_to_compare); if ($count1 === 0 && $count2 === 0) { @@ -396,9 +396,13 @@ class FieldItemList extends ItemList implements FieldItemListInterface { } // If the values are not equal ensure a consistent order of field item // properties and remove properties which will not be saved. - $callback = function (&$value) use ($columns) { + $property_definitions = $this->getFieldDefinition()->getFieldStorageDefinition()->getPropertyDefinitions(); + $non_computed_properties = array_filter($property_definitions, function (DataDefinitionInterface $property) { + return !$property->isComputed(); + }); + $callback = function (&$value) use ($non_computed_properties) { if (is_array($value)) { - $value = array_intersect_key($value, $columns); + $value = array_intersect_key($value, $non_computed_properties); ksort($value); } };