8.3.x ControllerBase.php protected ControllerBase::config($name)
8.0.x ControllerBase.php protected ControllerBase::config($name)
8.1.x ControllerBase.php protected ControllerBase::config($name)
8.2.x ControllerBase.php protected ControllerBase::config($name)
8.4.x ControllerBase.php protected ControllerBase::config($name)

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.

19 calls to ControllerBase::config()
AggregatorController::pageLast in core/modules/aggregator/src/Controller/AggregatorController.php
Displays the most recent items gathered from any feed.
BlockListController::listing in core/modules/block/src/Controller/BlockListController.php
Shows the block administration page.
ContactController::contactSitePage in core/modules/contact/src/Controller/ContactController.php
Presents the site-wide contact form.
ForumController::addContainer in core/modules/forum/src/Controller/ForumController.php
Returns add container entity form.
ForumController::addForum in core/modules/forum/src/Controller/ForumController.php
Returns add forum entity form.

... See full list

File

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

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