You are here

protected function BaseLayoutBase::getDefaultConfigOption in Layout Builder Base 8

Default behavior to get the default config option.

Return value

string Return the first option.

31 calls to BaseLayoutBase::getDefaultConfigOption()
BaseLayoutBase::getDefaultAlignItems in src/Plugin/Layout/BaseLayoutBase.php
Get the default align items option.
BaseLayoutBase::getDefaultAlignment in src/Plugin/Layout/BaseLayoutBase.php
Get the default alignment option.
BaseLayoutBase::getDefaultBackground in src/Plugin/Layout/BaseLayoutBase.php
Get the default background option.
BaseLayoutBase::getDefaultBackgroundAttachment in src/Plugin/Layout/BaseLayoutBase.php
Get the default background attachment option.
BaseLayoutBase::getDefaultBackgroundOverlay in src/Plugin/Layout/BaseLayoutBase.php
Get the default background overlay option.

... See full list

File

src/Plugin/Layout/BaseLayoutBase.php, line 586

Class

BaseLayoutBase
Configurable layout plugin class.

Namespace

Drupal\layout_builder_base\Plugin\Layout

Code

protected function getDefaultConfigOption($config_key, $options) {
  $default = $this->layoutBuilderBaseSettings
    ->get($config_key);
  $default_value = !empty($default) ? $default : '';
  if (empty($default_value)) {
    $options_keys = array_keys($options);
    $default_value = !empty($options_keys) ? array_shift($options_keys) : '';
  }
  return $default_value;
}