Same name and namespace in other branches
- 8.9.x core/lib/Drupal.php \Drupal::config()
- 9 core/lib/Drupal.php \Drupal::config()
Retrieves a configuration object.
This is the main entry point to the configuration API. Calling
\Drupal::config('my_module.admin');
will return a configuration object the my_module 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('my_module.admin');
, the configuration object returned will contain the content of the my_module.admin configuration file.
Return value
\Drupal\Core\Config\ImmutableConfig An immutable configuration object.
153 calls to Drupal::config()
- announcements_feed_cron in core/
modules/ announcements_feed/ announcements_feed.module - Implements hook_cron().
- AssetDumper::dumpToUri in core/
lib/ Drupal/ Core/ Asset/ AssetDumper.php - Dumps an (optimized) asset to persistent storage.
- 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().
File
- core/
lib/ Drupal.php, line 413
Class
- Drupal
- Static Service Container wrapper.
Code
public static function config($name) {
return static::getContainer()
->get('config.factory')
->get($name);
}