function LayoutBuilderHooks::entityTranslationCreate

Implements hook_entity_translation_create().

File

core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php, line 361

Class

LayoutBuilderHooks
Hook implementations for layout_builder.

Namespace

Drupal\layout_builder\Hook

Code

public function entityTranslationCreate(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.