HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/fabricas.colombiatrade.com.co/web_https/core/lib/Drupal/Core/Field/MapFieldItemList.php
<?php

namespace Drupal\Core\Field;

/**
 * Defines a item list class for map fields.
 */
class MapFieldItemList extends FieldItemList {

  /**
   * {@inheritdoc}
   */
  public function equals(FieldItemListInterface $list_to_compare) {
    $count1 = count($this);
    $count2 = count($list_to_compare);
    if ($count1 === 0 && $count2 === 0) {
      // Both are empty we can safely assume that it did not change.
      return TRUE;
    }
    if ($count1 !== $count2) {
      // The number of items is different so they do not have the same values.
      return FALSE;
    }

    // The map field type does not have any property defined (because they are
    // dynamic), so the only way to evaluate the equality for it is to rely
    // solely on its values.
    $value1 = $this->getValue();
    $value2 = $list_to_compare->getValue();

    return $value1 == $value2;
  }

}