public function CustomFormattersSettingsForm::buildForm in Custom Formatters 8.3
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/ CustomFormattersSettingsForm.php, line 30
Class
- CustomFormattersSettingsForm
- Configure update settings for this site.
Namespace
Drupal\custom_formatters\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('custom_formatters.settings');
$form['label_prefix'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Use Label prefix?'),
'#description' => $this
->t('If checked, all Custom Formatters labels will be prefixed with a set value.'),
'#default_value' => $config
->get('label_prefix'),
);
$form['label_prefix_value'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Label prefix'),
'#default_value' => $config
->get('label_prefix_value'),
'#states' => array(
'invisible' => array(
'input[name="label_prefix"]' => array(
'checked' => FALSE,
),
),
),
);
return parent::buildForm($form, $form_state);
}