argue-2.0.0-alpha4/modules/argue_versions/src/Form/ArgueVersionsSettingsForm.php
modules/argue_versions/src/Form/ArgueVersionsSettingsForm.php
<?php
namespace Drupal\argue_versions\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class ArgueVersionsSettingsForm.
*/
class ArgueVersionsSettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'argue_versions.settings',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'argue_versions_settings';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('argue_versions.settings');
$form['description'] = [
'#type' => 'text_format',
'#title' => $this->t('Description'),
'#description' => $this->t('Enter the description displayed on top of the version overview page.'),
'#default_value' => $config->get('description'),
];
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this->config('argue_versions.settings')
->set('description', $form_state->getValue('description')['value'])
->save();
}
}
