function MultiWidthLayoutBase::getDefaultWidth

Same name in other branches
  1. 9 core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php \Drupal\layout_builder\Plugin\Layout\MultiWidthLayoutBase::getDefaultWidth()
  2. 10 core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php \Drupal\layout_builder\Plugin\Layout\MultiWidthLayoutBase::getDefaultWidth()
  3. 11.x core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php \Drupal\layout_builder\Plugin\Layout\MultiWidthLayoutBase::getDefaultWidth()

Provides a default value for the width options.

Return value

string A key from the array returned by ::getWidthOptions().

1 call to MultiWidthLayoutBase::getDefaultWidth()
MultiWidthLayoutBase::defaultConfiguration in core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php
Gets default configuration for this plugin.
2 methods override MultiWidthLayoutBase::getDefaultWidth()
ThreeColumnLayout::getDefaultWidth in core/modules/layout_builder/src/Plugin/Layout/ThreeColumnLayout.php
Provides a default value for the width options.
TwoColumnLayout::getDefaultWidth in core/modules/layout_builder/src/Plugin/Layout/TwoColumnLayout.php
Provides a default value for the width options.

File

core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php, line 80

Class

MultiWidthLayoutBase
Base class of layouts with configurable widths.

Namespace

Drupal\layout_builder\Plugin\Layout

Code

protected function getDefaultWidth() {
    // Return the first available key from the list of options.
    $width_classes = array_keys($this->getWidthOptions());
    return array_shift($width_classes);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.