You are here

function layout_builder_entity_translation_create in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/layout_builder.module \layout_builder_entity_translation_create()
  2. 9 core/modules/layout_builder/layout_builder.module \layout_builder_entity_translation_create()

Implements hook_entity_translation_create().

File

core/modules/layout_builder/layout_builder.module, line 350
Provides hook implementations for Layout Builder.

Code

function layout_builder_entity_translation_create(EntityInterface $translation) {

  /** @var \Drupal\Core\Entity\FieldableEntityInterface $translation */
  if ($translation
    ->hasField(OverridesSectionStorage::FIELD_NAME) && $translation
    ->getFieldDefinition(OverridesSectionStorage::FIELD_NAME)
    ->isTranslatable()) {

    // When creating a new translation do not copy untranslated sections because
    // per-language layouts are not supported.
    $translation
      ->set(OverridesSectionStorage::FIELD_NAME, []);
  }
}