You are here

public function MergeTerms::buildForm in Term Merge 8

Plugin annotation

@SuppressWarnings(camelCase);

Overrides FormInterface::buildForm

File

src/Form/MergeTerms.php, line 84

Class

MergeTerms
Term merge form.

Namespace

Drupal\term_merge\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, VocabularyInterface $taxonomy_vocabulary = NULL) {
  $this->vocabulary = $taxonomy_vocabulary;
  $form['terms'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Terms to merge'),
    '#options' => $this
      ->getTermOptions($taxonomy_vocabulary),
    '#empty_option' => $this
      ->t('Select two or more terms to merge together'),
    '#multiple' => TRUE,
    '#required' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#button_type' => 'primary',
    '#type' => 'submit',
    '#value' => $this
      ->t('Merge'),
  ];
  return $form;
}