Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type.

Created on 13 April 2020, over 5 years ago
Updated 10 July 2025, 4 days ago

The Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type.

Purpose:
1. To fix the custom field weight on the bottom of the page that is in the field manage page at 'admin/structure/types/manage/page/fields'

Sometimes, use add some custom fields at above page, some string fields, some table fields, and so on. Then we want to order the big fields on the bottom of page and the light weight fields like string fields on the top of page in the view page.

Then, I would like to add a alter method, as below; override some function in the base class.

reproduce steps:
1. Add a hook in module, as below:
2. drush en any other module.

/**
 * Implements hook_entity_type_alter().
 */
function custom_module_entity_type_alter(array &$entity_types) {
  /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
  if (\Drupal::moduleHandler()->moduleExists('layout_builder')) {
    $entity_types['entity_view_display']
      ->setClass(\Drupal\custom_module\LayoutBuilderEntityViewDisplay::class);
  }
  else {
    $entity_types['entity_view_display']
      ->setClass(\Drupal\custom_module\Entity\Entity\EntityViewDisplay;::class);
  }
}

This `LayoutBuilderEntityViewDisplay` is override init function.

And then refresh the page, the page will broken a debug message like the title.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component

layout_builder.module

Created by

πŸ‡¨πŸ‡³China John.nie

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

  • DrupalFest2021

    To celebrate Drupal’s 20th birthday, we held DrupalFest, a month-long series of virtual events focused on community, contribution, and the positive impacts Drupal has made possible. The community collaborated on Drupal contributions, built skills at training workshops, and came together with the Drupal community for events ranging from game nights to virtual happy hours.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024