public function ConfigForm::buildForm in Color API 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ ConfigForm.php, line 76
Class
- ConfigForm
- Form definition for the Color API module configuration page.
Namespace
Drupal\colorapi\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('colorapi.settings');
$form['enable_color_field'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable Color Field'),
'#description' => $this
->t('When this box is checked, a "Color" field type will be enabled on the system.'),
'#default_value' => $config
->get('enable_color_field'),
];
$form['enable_color_entity'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable Color Entity'),
'#description' => $this
->t('When this box is checked, a "Color" configuration entity type will be enabled on the system.'),
'#default_value' => $config
->get('enable_color_entity'),
];
return parent::buildForm($form, $form_state);
}