You are here

public function SettingsForm::buildForm in Hashtags 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/SettingsForm.php, line 35

Class

SettingsForm

Namespace

Drupal\hashtags\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  filter_formats_reset();
  $config = $this
    ->config('hashtags.settings');
  $form['hashtags_taxonomy_terms_field_name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('"Hashtags taxonomy terms" field name'),
    '#default_value' => $config
      ->get('hashtags_taxonomy_terms_field_name'),
    '#required' => TRUE,
  ];
  $form['hashtags_vid'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Hashtags vocabulary'),
    '#options' => taxonomy_vocabulary_get_names(),
    '#default_value' => $config
      ->get('hashtags_vid'),
    '#required' => TRUE,
  ];
  $form['hide_field_hashtags'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Hide hashtags field'),
    '#default_value' => $config
      ->get('hide_field_hashtags'),
  ];
  return parent::buildForm($form, $form_state);
}