You are here

public static function Drupal::config in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal.php \Drupal::config()
  2. 9 core/lib/Drupal.php \Drupal::config()

Retrieves a configuration object.

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

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

will return a configuration object the Book module can use to read its administrative settings.

Parameters

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

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

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

Return value

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

171 calls to Drupal::config()
AccountForm::form in core/modules/user/src/AccountForm.php
Gets the actual form array to be built.
AssetDumper::dump in core/lib/Drupal/Core/Asset/AssetDumper.php
The file name for the CSS or JS cache file is generated from the hash of the aggregated contents of the files in $data. This forces proxies and browsers to download new CSS when the CSS changes.
automated_cron_form_system_cron_settings_alter in core/modules/automated_cron/automated_cron.module
Implements hook_form_FORM_ID_alter() for the system_cron_settings() form.
BasicAuthTest::testBasicAuth in core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php
Tests http basic authentication.
block_help in core/modules/block/block.module
Implements hook_help().

... See full list

File

core/lib/Drupal.php, line 400

Class

Drupal
Static Service Container wrapper.

Code

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