You are here

public function StatusForm::save in Heartbeat 8

File

modules/statusmessage/src/Form/StatusForm.php, line 142

Class

StatusForm
Form controller for Status edit forms.

Namespace

Drupal\statusmessage\Form

Code

public function save(array $form, FormStateInterface $form_state) {
  $entity = $this->entity;
  $status = parent::save($form, $form_state);
  switch ($status) {
    case SAVED_NEW:
      drupal_set_message($this
        ->t('Created the %label Status.', [
        '%label' => $entity
          ->label(),
      ]));
      break;
    default:
      drupal_set_message($this
        ->t('Saved the %label Status.', [
        '%label' => $entity
          ->label(),
      ]));
  }
  $form_state
    ->setRedirect('entity.status.canonical', [
    'status' => $entity
      ->id(),
  ]);
}