diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index a0d30be..b7a1913 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -461,13 +461,11 @@ function hook_entity_bundle_delete($entity_type_id, $bundle) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object. - * @param string $entity_type_id - * The type of entity being created (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_create() */ -function hook_entity_create(\Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_create(\Drupal\Core\Entity\EntityInterface $entity) { if ($entity instanceof ContentEntityInterface && !$entity->foo->value) { $entity->foo->value = 'some_initial_value'; } @@ -531,13 +529,11 @@ function hook_ENTITY_TYPE_load($entities) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object. - * @param string $entity_type_id - * The type of entity being saved (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_presave() */ -function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { $entity->changed = REQUEST_TIME; } @@ -562,13 +558,11 @@ function hook_ENTITY_TYPE_presave(Drupal\Core\Entity\EntityInterface $entity) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object. - * @param string $entity_type_id - * The type of entity being saved (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_insert() */ -function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) { // Insert the new entity into a fictional table of all entities. db_insert('example_entity') ->fields(array( @@ -611,13 +605,11 @@ function hook_ENTITY_TYPE_insert(Drupal\Core\Entity\EntityInterface $entity) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object. - * @param string $entity_type_id - * The type of entity being updated (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_update() */ -function hook_entity_update(Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_update(Drupal\Core\Entity\EntityInterface $entity) { // Update the entity's entry in a fictional table of all entities. db_update('example_entity') ->fields(array( @@ -658,13 +650,11 @@ function hook_ENTITY_TYPE_update(Drupal\Core\Entity\EntityInterface $entity) { * * @param \Drupal\Core\Entity\EntityInterface $translation * The entity object of the translation just stored. - * @param string $entity_type_id - * The type of entity being updated (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_translation_insert() */ -function hook_entity_translation_insert(\Drupal\Core\Entity\EntityInterface $translation, $entity_type_id) { +function hook_entity_translation_insert(\Drupal\Core\Entity\EntityInterface $translation) { $variables = array( '@language' => $translation->language()->name, '@label' => $translation->getUntranslated()->label(), @@ -699,13 +689,11 @@ function hook_ENTITY_TYPE_translation_insert(\Drupal\Core\Entity\EntityInterface * * @param \Drupal\Core\Entity\EntityInterface $entity * The original entity object. - * @param string $entity_type_id - * The type of entity being updated (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_translation_delete() */ -function hook_entity_translation_delete(\Drupal\Core\Entity\EntityInterface $translation, $entity_type_id) { +function hook_entity_translation_delete(\Drupal\Core\Entity\EntityInterface $translation) { $languages = \Drupal::languageManager()->getLanguages(); $variables = array( '@language' => $languages[$langcode]->name, @@ -739,13 +727,11 @@ function hook_ENTITY_TYPE_translation_delete(\Drupal\Core\Entity\EntityInterface * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object for the entity that is about to be deleted. - * @param string $entity_type_id - * The type of entity being deleted (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_predelete() */ -function hook_entity_predelete(Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_predelete(Drupal\Core\Entity\EntityInterface $entity) { // Count references to this entity in a custom table before they are removed // upon entity deletion. $id = $entity->id(); @@ -799,13 +785,11 @@ function hook_ENTITY_TYPE_predelete(Drupal\Core\Entity\EntityInterface $entity) * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object for the entity that has been deleted. - * @param string $entity_type_id - * The type of entity being deleted (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_delete() */ -function hook_entity_delete(Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_delete(Drupal\Core\Entity\EntityInterface $entity) { // Delete the entity's entry from a fictional table of all entities. db_delete('example_entity') ->condition('type', $entity->getEntityTypeId()) @@ -839,13 +823,11 @@ function hook_ENTITY_TYPE_delete(Drupal\Core\Entity\EntityInterface $entity) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object for the entity revision that has been deleted. - * @param string $entity_type_id - * The type of entity being deleted (i.e. node, user, comment). * * @ingroup entity_crud * @see hook_ENTITY_TYPE_revision_delete() */ -function hook_entity_revision_delete(Drupal\Core\Entity\EntityInterface $entity, $entity_type_id) { +function hook_entity_revision_delete(Drupal\Core\Entity\EntityInterface $entity) { $referenced_files_by_field = _editor_get_file_uuids_by_field($entity); foreach ($referenced_files_by_field as $field => $uuids) { _editor_delete_file_usage($uuids, $entity, 1); diff --git a/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module b/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module index 4e6510d..c7f20c3 100644 --- a/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module +++ b/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module @@ -101,7 +101,7 @@ function entity_crud_hook_test_node_presave() { /** * Implements hook_ENTITY_TYPE_presave() for taxonomy_term entities. */ -function entity_crud_hook_taxonomy_term_presave() { +function entity_crud_hook_test_taxonomy_term_presave() { $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called'); }