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

Breadcrumb

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

function LayoutBuilderHooks::entityBuildDefaultsAlter

Implements hook_entity_build_defaults_alter().

File

core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php, line 182

Class

LayoutBuilderHooks
Hook implementations for layout_builder.

Namespace

Drupal\layout_builder\Hook

Code

public function entityBuildDefaultsAlter(array &$build, EntityInterface $entity, $view_mode) : void {
    // Contextual links are removed for entities viewed in Layout Builder's UI.
    // The route.name.is_layout_builder_ui cache context accounts for this
    // difference.
    // @see layout_builder_entity_view_alter()
    // @see \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext
    $build['#cache']['contexts'][] = 'route.name.is_layout_builder_ui';
}

API Navigation

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