You are here

public function TaxonomyDeleteUIForm::buildForm in Taxonomy Delete 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 FormInterface::buildForm

File

src/Form/TaxonomyDeleteUIForm.php, line 25

Class

TaxonomyDeleteUIForm
Class TaxonomyDeleteUIForm.

Namespace

Drupal\taxonomy_delete\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $vocabulary = [];
  $vocabulary_items = taxonomy_vocabulary_get_names();
  foreach ($vocabulary_items as $item) {
    $vocabulary[$item] = ucfirst(str_replace("_", " ", $item));
  }
  $form['vocabulary'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Vocabularies'),
    '#options' => $vocabulary,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Delete Terms'),
  ];
  return $form;
}