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

10 calls to FormBase::config()
AddFormBase::isAdvancedUi in core/modules/media_library/src/Form/AddFormBase.php
Determines if the "advanced UI" of the Media Library is enabled.
BlockContentForm::configureBlock in core/modules/block_content/src/BlockContentForm.php
Form submission handler for the 'configureBlock' action.
BlockForm::form in core/modules/block/src/BlockForm.php
Gets the actual form array to be built.
ConfigSingleImportForm::validateForm in core/modules/config/src/Form/ConfigSingleImportForm.php
Form validation handler.
ExportForm::submitForm in core/modules/locale/src/Form/ExportForm.php
Form submission handler.

... See full list

File

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

Class

FormBase
Provides a base class for forms.

Namespace

Drupal\Core\Form

Code

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