Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Drupal.php

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

32 calls to Drupal::config()
AccountForm::form in core/modules/user/src/AccountForm.php
Gets the actual form array to be built.
AnnouncementsFeedHooks::cron in core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php
Implements hook_cron().
AutomatedCronHooks::formSystemCronSettingsAlter in core/modules/automated_cron/src/Hook/AutomatedCronHooks.php
Implements hook_form_FORM_ID_alter() for the system_cron_settings() form.
FileHooks::formSystemFileSystemSettingsAlter in core/modules/file/src/Hook/FileHooks.php
Implements hook_form_FORM_ID_alter().
FileWidget::process in core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
Form API callback: Processes a file_generic field element.

... See full list

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);
}
RSS feed
Powered by Drupal