You are here

public function Fz152SettingsPage::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/Fz152SettingsPage.php, line 33

Class

Fz152SettingsPage
Configure example settings for this site.

Namespace

Drupal\fz152\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('fz152.privacy_policy_page');
  $form['enabled'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable privacy policy page'),
    '#default_value' => $config
      ->get('enable'),
  ];
  $form['path'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Privacy policy page path'),
    '#default_value' => $config
      ->get('path'),
  ];
  $form['title'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Privacy policy page title'),
    '#default_value' => $config
      ->get('title'),
  ];
  $text = $config
    ->get('text');
  $default_text = $text['value'];
  $default_format = isset($text['format']) ? $text['format'] : filter_default_format();
  $form['text'] = [
    '#type' => 'text_format',
    '#title' => $this
      ->t('Privacy policy text'),
    '#default_value' => $default_text,
    '#format' => $default_format,
  ];
  return parent::buildForm($form, $form_state);
}