ThemeRegistryAlter must fallback on default templates

Created on 26 July 2025, 3 days ago

Problem/Motivation

📌 [1.0.0-beta1] Add proper page management Active has introducing a fallback on Block Layout is a page isn't caught by a Page Layout entity. See PageVariantSubscriber:

    // In admin pages, we want the page.html.twig  from the admin theme.
    if ($options['_admin_route'] ?? FALSE) {
      return;
    }

    // Fallback to Block Layout if there is no suitable Page Layout entities.
    $access_control = $this->entityTypeManager->getAccessControlHandler('page_layout');
    $page_layout = $access_control->loadCurrentPageLayout();
    if (!$page_layout) {
      return;
    }

However, ThemeRegistryAlter is only testing the admin route:

    if ($this->adminContext->isAdminRoute()) {
      return;
    }

So, the page looks bad, wit the expected blocks but not the expected layout templates.

Proposed resolution

Test the access control here in ThemeRegistryAlter too

📌 Task
Status

Active

Version

1.0

Component

display_builder_page_layout

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @pdureau
  • 🇫🇷France pdureau Paris

    Also, do that: Skip region--content.html.twig

    page.html.twig and info.yml's regions are skipped

    However, instead of building the page variable or html.html.twig, we are building the content variable of region--content.html.twig (or region.html.twig)

    content is a mandatory region in theme systems.

    Find a way of skipping all page regions, because display builder take control of this layer.

Production build 0.71.5 2024