function hook_entity_translation_create

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_translation_create()
  2. 10 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_translation_create()
  3. 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_translation_create()

Acts when creating a new entity translation.

This hook runs after a new entity translation object has just been instantiated.

Parameters

\Drupal\Core\Entity\EntityInterface $translation: The entity object.

See also

hook_ENTITY_TYPE_translation_create()

Related topics

6 functions implement hook_entity_translation_create()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

EntityTestHooks::entityTranslationCreate in core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
Implements hook_entity_translation_create().
entity_test_entity_translation_create in core/modules/system/tests/modules/entity_test/entity_test.module
Implements hook_entity_translation_create().
LayoutBuilderHooks::entityTranslationCreate in core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php
Implements hook_entity_translation_create().
layout_builder_entity_translation_create in core/modules/layout_builder/layout_builder.module
Implements hook_entity_translation_create().
PathHooks::entityTranslationCreate in core/modules/path/src/Hook/PathHooks.php
Implements hook_entity_translation_create().

... See full list

1 invocation of hook_entity_translation_create()
ContentEntityStorageBase::createTranslation in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Constructs a new entity translation object, without permanently saving it.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1274

Code

function hook_entity_translation_create(\Drupal\Core\Entity\EntityInterface $translation) {
    \Drupal::logger('example')->info('Entity translation created: @label', [
        '@label' => $translation->label(),
    ]);
}

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