W3cubDocs

/Drupal 8

trait ConfigFormBaseTrait

Provides access to configuration for forms.

This trait provides a config() method that returns override free and mutable config objects if the configuration name is in the array returned by the getEditableConfigNames() implementation.

Forms that present configuration to the user have to take care not to save configuration overrides to the stored configuration since overrides are often environment specific. Default values of form elements should be obtained from override free configuration objects. However, if a form reacts to configuration in any way, for example sends an email to the system.site:mail address, then it is important that the value comes from a configuration object with overrides. Therefore, override free and editable configuration objects are limited to those listed by the getEditableConfigNames() method.

Hierarchy

File

core/lib/Drupal/Core/Form/ConfigFormBaseTrait.php, line 23

Namespace

Drupal\Core\Form

Members

Name Modifiers Type Description
ConfigFormBaseTrait::config protected function Retrieves a configuration object.
ConfigFormBaseTrait::getEditableConfigNames abstract protected function Gets the configuration names that will be editable.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Form!ConfigFormBaseTrait.php/trait/ConfigFormBaseTrait/8.1.x