8.5.x Drupal.php Drupal::config($name)
8.0.x Drupal.php Drupal::config($name)
8.1.x Drupal.php Drupal::config($name)
8.2.x Drupal.php Drupal::config($name)
8.3.x Drupal.php Drupal::config($name)
8.4.x Drupal.php Drupal::config($name)
8.6.x Drupal.php Drupal::config($name)

Retrieves a configuration object.

This is the main entry point to the configuration API. Calling

\Drupal::config('book.admin');

will return a configuration object in which the book module can store its administrative settings.

Parameters

string $name: The name of the configuration object to retrieve. The name corresponds to a configuration file. For

\Drupal::config('book.admin');

, the config object returned will contain the contents of book.admin configuration file.

Return value

\Drupal\Core\Config\ImmutableConfig An immutable configuration object.

File

core/lib/Drupal.php, line 341
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function config($name) {
  return static::getContainer()
    ->get('config.factory')
    ->get($name);
}