Problem/Motivation

Layout Builder overrides require that the entity has a canonical route available, which is usually tied to the "default" view mode.

Layout Builder defaults have no such requirement, as they are usable by any view mode.

layout_builder_entity_type_alter() provides a layout-builder link template only for entity types that:

  • are fieldable
  • have a view builder
  • have a canonical link template

This logic is then used throughout the module to determine which entities get the Layout Builder UI provided.

However, the logic should instead be split, and clarified.
Overrides should only work for entity types that:

  • are fieldable
  • have a view builder
  • have a canonical link template

Defaults should work for entity types that:

  • are fieldable
  • have a view builder
  • have a Field UI base route

Proposed resolution

Instead of having this logic within this hook and referencing it from each plugin, keep the logic stored within each plugin.
The logic will continue to need to be copied into LayoutBuilderLocalTaskDeriver, as that still remains a workaround for #2936655: Layout Builder should use the toolbar modes system once it exists.

Remaining tasks

N/A

User interface changes

N/A

API changes

The "layout-builder" link template is removed.

Data model changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett created an issue. See original summary.

tim.plunkett’s picture

Status: Active » Needs review
FileSize
14.92 KB
EclipseGc’s picture

Status: Needs review » Reviewed & tested by the community

This looks good, and the tests look great. Glad to see us nail this down.

Eclipse

tim.plunkett’s picture

I forgot to post a tests-only version, doing so now.

tim.plunkett’s picture

The last submitted patch, 4: 2942590-link_template-4-FAIL.patch, failed testing. View results

EclipseGc’s picture

tim.plunkett’s picture

Priority: Normal » Major

Bumping to major as this is a contributed project blocker and should be backported to 8.5.x ASAP

  • larowlan committed c57b190 on 8.6.x
    Issue #2942590 by tim.plunkett: Layout Builder defaults should work...

  • larowlan committed 17e4881 on 8.5.x
    Issue #2942590 by tim.plunkett: Layout Builder defaults should work...
larowlan’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed
diff --git a/core/modules/layout_builder/layout_builder.module b/core/modules/layout_builder/layout_builder.module
index 220f42c..2138a04 100644
--- a/core/modules/layout_builder/layout_builder.module
+++ b/core/modules/layout_builder/layout_builder.module
@@ -5,7 +5,6 @@
  * Provides hook implementations for Layout Builder.
  */
 
-use Drupal\Core\Entity\FieldableEntityInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Url;

fixed on commit

Committed as c57b190 and pushed to 8.6.x.
C/P'd as 17e4881 and pushed to 8.5.x.

tim.plunkett’s picture

Component: layout.module » layout_builder.module

Status: Fixed » Closed (fixed)

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