Problem/Motivation

Layout Builder only exposes its Layout local task on the default (original) translation of an entity.

Steps to reproduce

  1. Enable Layout Builder overrides for a content type and enable a second language with translation.
  2. Create a node and add a translation (e.g. English original + Arabic translation).
  3. Edit/view the node in the original language — the Layout tab is present in the toolbar/local tasks.
  4. Switch to the translation (e.g. /ar/node/1/edit) — the Layout tab is gone.

Proposed resolution

Implement hook_menu_local_tasks_alter() to keep the Layout local task visible on non-default translations, pointing it at the layout page of the original language.

  • Detect the Layout Builder override local task by its plugin id (…layout_builder.overrides.<entity_type_id>.view).
  • Act only when the routed entity is a translatable content entity and is not the default translation (core already handles the default language).
  • Repoint the tab URL to layout_builder.overrides.<type>.view with the original language, so clicking Layout redirects the editor to the original-language layout page.
  • Evaluate access against the default translation by loading the overrides section storage with the untranslated entity (rather than Url::access(), which re-loads the entity in the active content language and is always denied). This preserves the user's real layout permissions.
  • Add cache contexts languages:language_content and user.permissions, plus the access result and entity as cacheable dependencies.

User interface changes

The Layout local task (and therefore the Seeds Toolbar entry) is now shown on translations for users who have permission to configure the layout. Selecting it navigates to the original-language layout page. No change on the default language.

Comments

ahmad-alyasaki created an issue. See original summary.

  • 80d3d963 committed on 2.x
    task: #3606857 Layout local task hidden when editing a translation;...
ahmad-alyasaki’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.