function ControllerBase::config

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::config()
  2. 10 core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::config()
  3. 11.x core/lib/Drupal/Core/Controller/ControllerBase.php \Drupal\Core\Controller\ControllerBase::config()

Retrieves a configuration object.

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

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

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

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

Return value

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

8 calls to ControllerBase::config()
ContactController::contactSitePage in core/modules/contact/src/Controller/ContactController.php
Presents the site-wide contact form.
ForumController::build in core/modules/forum/src/Controller/ForumController.php
Returns a renderable forum index page array.
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.

... See full list

File

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

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);
}

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