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

Breadcrumb

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

function ControllerBase::config

Retrieves a configuration object.

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

$this->config('my_module.admin');

will return a configuration object in which the my_module 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('my_module.admin');

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

Return value

\Drupal\Core\Config\Config A configuration object.

7 calls to ControllerBase::config()
ContactController::contactSitePage in core/modules/contact/src/Controller/ContactController.php
Presents the site-wide contact form.
SystemController::themesPage in core/modules/system/src/Controller/SystemController.php
Returns a theme listing which excludes obsolete themes.
ThemeController::uninstall in core/modules/system/src/Controller/ThemeController.php
Uninstalls a theme.
UserAuthenticationController::floodControl in core/modules/user/src/Controller/UserAuthenticationController.php
Enforces flood control for the current login request.
UserAuthenticationController::getLoginFloodIdentifier in core/modules/user/src/Controller/UserAuthenticationController.php
Gets the login identifier for user login flood control.

... See full list

File

core/lib/Drupal/Core/Controller/ControllerBase.php, line 162

Class

ControllerBase
Utility base class for thin controllers.

Namespace

Drupal\Core\Controller

Code

protected function config($name) {
    if (!$this->configFactory) {
        $this->configFactory = $this->container()
            ->get('config.factory');
    }
    return $this->configFactory
        ->get($name);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal