You are here

public function Fz152Settings::buildForm in FZ152 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/Fz152Settings.php, line 32

Class

Fz152Settings
Configure example settings for this site.

Namespace

Drupal\fz152\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('fz152.settings');
  $form['enable'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable functionality'),
    '#description' => $this
      ->t('You can disable this functionality for different languages.'),
    '#default_value' => $config
      ->get('enable'),
  ];
  $form['is_checkbox'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show with checkbox'),
    '#description' => $this
      ->t('If checked, text will be printed in form with checkbox.'),
    '#default_value' => $config
      ->get('is_checkbox'),
  ];
  $form['checkbox_title'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Checkbox title'),
    '#default_value' => $config
      ->get('checkbox_title'),
  ];
  return parent::buildForm($form, $form_state);
}