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

Breadcrumb

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

function Section::getNextHighestWeight

Returns the next highest weight of the component in a region.

Parameters

string $region: The region name.

Return value

int A number higher than the highest weight of the component in the region.

1 call to Section::getNextHighestWeight()
Section::appendComponent in core/modules/layout_builder/src/Section.php
Appends a component to the end of a region.

File

core/modules/layout_builder/src/Section.php, line 251

Class

Section
Provides a domain object for layout sections.

Namespace

Drupal\layout_builder

Code

protected function getNextHighestWeight($region) {
    $components = $this->getComponentsByRegion($region);
    $weights = array_map(function (SectionComponent $component) {
        return $component->getWeight();
    }, $components);
    return $weights ? max($weights) + 1 : 0;
}

API Navigation

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