You are here

public function ConfigManagerService::getOverrideOptionsFromPropertyName in Layout Builder Base 8

Get the override options from the config by property.

Parameters

string $property: The property.

Return value

array THe override options.

1 call to ConfigManagerService::getOverrideOptionsFromPropertyName()
ConfigManagerService::getMergedOptionsWithOverrides in src/ConfigManagerService.php
Function get the options merged with the possible overrides in the config.

File

src/ConfigManagerService.php, line 43

Class

ConfigManagerService
Class ConfigManagerService.

Namespace

Drupal\layout_builder_base

Code

public function getOverrideOptionsFromPropertyName($property) {
  $options = [];
  $config_name = SettingsForm::getOverrideConfigName($property);
  $config_value = $this->layoutBuilderBaseSettings
    ->get($config_name);
  if (!empty($config_value)) {
    $options_values = explode(PHP_EOL, $config_value);
    foreach ($options_values as $option_value) {
      $data = array_map('trim', explode('|', $option_value));
      $options[$data[0]] = count($data) === 2 ? $data[1] : $data[0];
    }
  }
  return $options;
}