function Drupal::config

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

Retrieves a configuration object.

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


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


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


, 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.

43 calls to Drupal::config()
AccountForm::form in core/modules/user/src/AccountForm.php
Gets the actual form array to be built.
announcements_feed_cron in core/modules/announcements_feed/announcements_feed.module
Implements hook_cron().
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.
book_breadcrumb_test_node_access in core/modules/book/tests/modules/book_breadcrumb_test/book_breadcrumb_test.module
Implements hook_ENTITY_TYPE_access().
ConfigInstallWebTest::testIntegrationModuleReinstallation in core/modules/config/tests/src/Functional/ConfigInstallWebTest.php
Tests module re-installation.

... See full list


core/lib/Drupal.php, line 413


Static Service Container wrapper.


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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.