Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LayoutBuilderHooks.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal