class ChangedFieldItemList

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Field/ChangedFieldItemList.php \Drupal\Core\Field\ChangedFieldItemList
  2. 10 core/lib/Drupal/Core/Field/ChangedFieldItemList.php \Drupal\Core\Field\ChangedFieldItemList
  3. 8.9.x core/lib/Drupal/Core/Field/ChangedFieldItemList.php \Drupal\Core\Field\ChangedFieldItemList

Defines an item list class for changed fields.

Hierarchy

Expanded class hierarchy of ChangedFieldItemList

File

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

Namespace

Drupal\Core\Field
View source
class ChangedFieldItemList extends FieldItemList {
  
  /**
   * {@inheritdoc}
   */
  public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
    // It is not possible to edit the changed field.
    return AccessResult::allowedIf($operation !== 'edit');
  }
  
  /**
   * {@inheritdoc}
   */
  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;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.