function FormBase::config

Same name in other branches
  1. 9 core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::config()
  2. 10 core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::config()
  3. 11.x core/lib/Drupal/Core/Form/FormBase.php \Drupal\Core\Form\FormBase::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\ImmutableConfig A configuration object.

6 calls to FormBase::config()
CommentForm::form in core/modules/comment/src/CommentForm.php
Gets the actual form array to be built.
ConfigSingleImportForm::validateForm in core/modules/config/src/Form/ConfigSingleImportForm.php
Form validation handler.
Overview::buildForm in core/modules/forum/src/Form/Overview.php
Form constructor.
UserLoginForm::buildForm in core/modules/user/src/Form/UserLoginForm.php
Form constructor.
UserLoginForm::validateAuthentication in core/modules/user/src/Form/UserLoginForm.php
Checks supplied username/password against local users table.

... See full list

File

core/lib/Drupal/Core/Form/FormBase.php, line 112

Class

FormBase
Provides a base class for forms.

Namespace

Drupal\Core\Form

Code

protected function config($name) {
    return $this->configFactory()
        ->get($name);
}

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