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

Breadcrumb

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

function LayoutBuilderEntityViewDisplay::getDefaultSection

Gets a default section.

Return value

\Drupal\layout_builder\Section The default section.

1 call to LayoutBuilderEntityViewDisplay::getDefaultSection()
LayoutBuilderEntityViewDisplay::setComponent in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Sets the display options for a component.

File

core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php, line 470

Class

LayoutBuilderEntityViewDisplay
Provides an entity view display entity that has a layout.

Namespace

Drupal\layout_builder\Entity

Code

protected function getDefaultSection() {
    // If no section exists, append a new one.
    if (!$this->hasSection(0)) {
        $this->appendSection(new Section('layout_onecol'));
    }
    // Return the first section.
    return $this->getSection(0);
}

API Navigation

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