class ConfigFormBase
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase
- 9 core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase
- 10 core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase
Base class for implementing system configuration forms.
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Routing\LinkGeneratorTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\Routing\UrlGeneratorTrait
- class \Drupal\Core\Form\ConfigFormBase uses \Drupal\Core\Form\ConfigFormBaseTrait extends \Drupal\Core\Form\FormBase
Expanded class hierarchy of ConfigFormBase
34 files declare their use of ConfigFormBase
- AccountSettingsForm.php in core/
modules/ user/ src/ AccountSettingsForm.php - AdvancedSettingsForm.php in core/
modules/ views_ui/ src/ Form/ AdvancedSettingsForm.php - BasicSettingsForm.php in core/
modules/ views_ui/ src/ Form/ BasicSettingsForm.php - BookSettingsForm.php in core/
modules/ book/ src/ Form/ BookSettingsForm.php - FileSystemForm.php in core/
modules/ system/ src/ Form/ FileSystemForm.php
File
-
core/
lib/ Drupal/ Core/ Form/ ConfigFormBase.php, line 11
Namespace
Drupal\Core\FormView source
abstract class ConfigFormBase extends FormBase {
use ConfigFormBaseTrait;
/**
* Constructs a \Drupal\system\ConfigFormBase object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->setConfigFactory($config_factory);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Save configuration'),
'#button_type' => 'primary',
];
// By default, render the form using system-config-form.html.twig.
$form['#theme'] = 'system_config_form';
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->messenger()
->addStatus($this->t('The configuration options have been saved.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.