You are here

public function AddFolderForm::submitForm in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x src/Form/AddFolderForm.php \Drupal\tft\Form\AddFolderForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/AddFolderForm.php, line 77

Class

AddFolderForm
Add a term form.

Namespace

Drupal\tft\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $term = Term::create([
    'vid' => 'tft_tree',
    'name' => $form_state
      ->getValue('name'),
    'parent' => $form_state
      ->getValue('parent'),
  ]);
  $term
    ->save();
  return $term
    ->id();
}