PathFormBase::submitForm

public PathFormBase::submitForm(array &$form, FormStateInterface $form_state)

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

core/modules/path/src/Form/PathFormBase.php, line 203

Class

PathFormBase
Provides a base class for path add/edit forms.

Namespace

Drupal\path\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  // Remove unnecessary values.
  $form_state->cleanValues();

  $pid = $form_state->getValue('pid', 0);
  $source = $form_state->getValue('source');
  $alias = $form_state->getValue('alias');
  // Language is only set if language.module is enabled, otherwise save for all
  // languages.
  $langcode = $form_state->getValue('langcode', LanguageInterface::LANGCODE_NOT_SPECIFIED);

  $this->aliasStorage->save($source, $alias, $langcode, $pid);

  drupal_set_message($this->t('The alias has been saved.'));
  $form_state->setRedirect('path.admin_overview');
}
doc_Drupal
2016-10-29 09:33:25
Comments
Leave a Comment

Please login to continue.