Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / entity_test.module
index 8b4f2ba82726de9d9222e162220bb9db7f859b45..66a42e2931c68ca4620d9b7bc61effdfc101046c 100644 (file)
@@ -101,6 +101,9 @@ function entity_test_entity_type_alter(array &$entity_types) {
   if (!$state->get('entity_test_new')) {
     unset($entity_types['entity_test_new']);
   }
+
+  $entity_test_definition = $entity_types['entity_test'];
+  $entity_test_definition->set('entity_keys', $state->get('entity_test.entity_keys', []) + $entity_test_definition->getKeys());
 }
 
 /**
@@ -303,7 +306,7 @@ function entity_test_entity_extra_field_info() {
         'description' => t('An extra field on the display side, hidden by default.'),
         'visible' => FALSE,
       ],
-    ]
+    ],
   ];
 
   return $extra;
@@ -677,6 +680,23 @@ function entity_test_entity_test_mul_langcode_key_translation_delete(EntityInter
   _entity_test_record_hooks('entity_test_mul_langcode_key_translation_delete', $translation->language()->getId());
 }
 
+/**
+ * Implements hook_entity_revision_create().
+ */
+function entity_test_entity_revision_create(EntityInterface $new_revision, EntityInterface $entity, $keep_untranslatable_fields) {
+  _entity_test_record_hooks('entity_revision_create', ['new_revision' => $new_revision, 'entity' => $entity, 'keep_untranslatable_fields' => $keep_untranslatable_fields]);
+}
+
+/**
+ * Implements hook_ENTITY_TYPE_revision_create() for 'entity_test_mulrev'.
+ */
+function entity_test_entity_test_mulrev_revision_create(EntityInterface $new_revision, EntityInterface $entity, $keep_untranslatable_fields) {
+  if ($new_revision->get('name')->value == 'revision_create_test_it') {
+    $new_revision->set('name', 'revision_create_test_it_altered');
+  }
+  _entity_test_record_hooks('entity_test_mulrev_revision_create', ['new_revision' => $new_revision, 'entity' => $entity, 'keep_untranslatable_fields' => $keep_untranslatable_fields]);
+}
+
 /**
  * Field default value callback.
  *