public function TermFormController::submit

Overrides Drupal\Core\Entity\EntityFormController::submit().

Overrides EntityFormController::submit

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php, line 141
Definition of Drupal\taxonomy\TermFormController.

Class

TermFormController
Base for controller for taxonomy term edit forms.

Namespace

Drupal\taxonomy

Code

public function submit(array $form, array &$form_state) {
  $term = parent::submit($form, $form_state);

  // Prevent leading and trailing spaces in term names.
  $term->name = trim($term->name);

  // Convert text_format field into values expected by taxonomy_term_save().
  $description = $form_state['values']['description'];
  $term->description = $description['value'];
  $term->format = $description['format'];
  return $term;
}