Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Field / ChangedFieldItemList.php
1 <?php
2
3 namespace Drupal\Core\Field;
4
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Session\AccountInterface;
7
8 /**
9  * Defines a item list class for changed fields.
10  */
11 class ChangedFieldItemList extends FieldItemList {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
17     // It is not possible to edit the changed field.
18     return AccessResult::allowedIf($operation !== 'edit');
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function hasAffectingChanges(FieldItemListInterface $original_items, $langcode) {
25     // When saving entities in the user interface, the changed timestamp is
26     // automatically incremented by ContentEntityForm::submitForm() even if
27     // nothing was actually changed. Thus, the changed time needs to be
28     // ignored when determining whether there are any actual changes in the
29     // entity.
30     return FALSE;
31   }
32
33 }