You are here

protected function NameGenerator::loadConfiguration in Name Field 8

Helper function to load the settings.

Parameters

string $config: The configuration to load.

string $key: The configuration key to retrieve.

\Drupal\Core\Field\FieldDefinitionInterface|null $field_definition: The field definition to find field specific configuration.

Return value

array The array of settings.

Throws

\Drupal\Core\Config\ConfigException An error if the global configuration is empty or missing.

2 calls to NameGenerator::loadConfiguration()
NameGenerator::generateSampleNames in src/NameGenerator.php
Service to generate random names.
NameGenerator::loadSampleValues in src/NameGenerator.php
Service to load preconfigured names.

File

src/NameGenerator.php, line 191

Class

NameGenerator
Handles name generation.

Namespace

Drupal\name

Code

protected function loadConfiguration($config, $key, FieldDefinitionInterface $field_definition = NULL) {
  $components = [];
  if ($field_definition) {
    $components = $this->configFactory
      ->get($config . '.' . $field_definition
      ->getName())
      ->get($key);
  }
  if (!$components) {
    $components = $this->configFactory
      ->get($config)
      ->get($key);
  }
  return $components;
}