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());
}
/**
'description' => t('An extra field on the display side, hidden by default.'),
'visible' => FALSE,
],
- ]
+ ],
];
return $extra;
_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.
*