You are here

public function MergeTermsTarget::buildForm in Term Merge 8

Plugin annotation

@SuppressWarnings(camelCase);

Overrides FormInterface::buildForm

File

src/Form/MergeTermsTarget.php, line 96

Class

MergeTermsTarget
Term merge target terms form.

Namespace

Drupal\term_merge\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, VocabularyInterface $taxonomy_vocabulary = NULL) {
  $this->vocabulary = $taxonomy_vocabulary;
  $form['description']['#markup'] = $this
    ->t('Please enter a new term or select an existing term to merge into.');
  $form['new'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('New term'),
  ];
  $form['existing'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Existing term'),
    '#empty_option' => $this
      ->t('Select an existing term'),
    '#options' => $this
      ->buildExistingTermsOptions(),
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#button_type' => 'primary',
    '#type' => 'submit',
    '#value' => $this
      ->t('Submit'),
  ];
  return $form;
}