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

Breadcrumb

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

function EntityDisplayBase::preSave

Overrides ConfigEntityBase::preSave

2 calls to EntityDisplayBase::preSave()
LayoutBuilderEntityViewDisplay::preSave in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Acts on an entity before the presave hook is invoked.
LayoutBuilderEntityViewDisplay::preSave in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Acts on an entity before the presave hook is invoked.
1 method overrides EntityDisplayBase::preSave()
LayoutBuilderEntityViewDisplay::preSave in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Acts on an entity before the presave hook is invoked.

File

core/lib/Drupal/Core/Entity/EntityDisplayBase.php, line 260

Class

EntityDisplayBase
Provides a common base class for entity view and form displays.

Namespace

Drupal\Core\Entity

Code

public function preSave(EntityStorageInterface $storage) {
    // Ensure that a region is set on each component.
    foreach ($this->getComponents() as $name => $component) {
        // Ensure that a region is set.
        if (isset($this->content[$name]) && !isset($component['region'])) {
            // Directly set the component to bypass other changes in setComponent().
            $this->content[$name]['region'] = $this->getDefaultRegion();
        }
    }
    ksort($this->content);
    ksort($this->hidden);
    parent::preSave($storage);
}

API Navigation

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