function layout_builder_entity_translation_create

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/layout_builder.module \layout_builder_entity_translation_create()
  2. 8.9.x core/modules/layout_builder/layout_builder.module \layout_builder_entity_translation_create()
  3. 10 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 357

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, []);
    }
}

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