Here is the code of a custom form:
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = parent::save($form, $form_state);
$values=$form_state->getValues();
some code here...
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Le service « %label » a été ajouté.', [
'%label' => $entity->label(),
]));
break;
default:
drupal_set_message($this->t('Le service « %label » a été modifié.', [
'%label' => $entity->label(),
]));
}
$form_state->setRedirect('view.services.page_2');
}
The redirection doesn't work!
After validating my form, it goes to the first page of my view.
By the way, these two pages of the view are displayed as two tabs in a menu (the first being the default one)...
view.services.page_2
route will take you to thepage_2
page display of theservices
view. Are you saying this is not happening? It's taking you to thepage_1
page display of theservices
view?