You are here

public function TranslatorForm::save in Translation Management Tool 8

Overrides Drupal\Core\Entity\EntityForm::save().

Overrides EntityForm::save

File

src/Form/TranslatorForm.php, line 242

Class

TranslatorForm
Form controller for the translator edit forms.

Namespace

Drupal\tmgmt\Form

Code

public function save(array $form, FormStateInterface $form_state) {
  $entity = $this->entity;
  $status = $entity
    ->save();
  if ($status === SAVED_UPDATED) {
    \Drupal::messenger()
      ->addStatus($this
      ->t('%label configuration has been updated.', array(
      '%label' => $entity
        ->label(),
    )));
  }
  else {
    \Drupal::messenger()
      ->addStatus($this
      ->t('%label configuration has been created.', array(
      '%label' => $entity
        ->label(),
    )));
  }
  $form_state
    ->setRedirect('entity.tmgmt_translator.collection');
}