Skip to main content
added link to the documentation
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

The logout controller seems to do(UserController::logout()) does this in a separate step:

\Drupal\user\Controller\UserController::logout.

  public function logout() {
    user_logout();
    return $this->redirect('<front>');
  }

You can alter the controller class infor the route user.logoutuser.logout route to replace this with custom code. The question is, what

What do you want to do instead, because to build? Building an anonymous response a redirect seems to be the most straightforward solution.

The logout controller seems to do this in a separate step:

\Drupal\user\Controller\UserController::logout

  public function logout() {
    user_logout();
    return $this->redirect('<front>');
  }

You can alter the controller class in the route user.logout to replace this with custom code. The question is, what you want to do instead, because to build an anonymous response a redirect seems to be the most straightforward solution.

The logout controller (UserController::logout()) does this in a separate step.

  public function logout() {
    user_logout();
    return $this->redirect('<front>');
  }

You can alter the controller class for the user.logout route to replace this with custom code.

What do you want to do instead? Building an anonymous response a redirect seems to be the most straightforward solution.

Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

The logout controller seems to do this in a separate step:

\Drupal\user\Controller\UserController::logout

  public function logout() {
    user_logout();
    return $this->redirect('<front>');
  }

You can alter the controller class in the route user.logout to replace this with custom code. The question is, what you want to do instead, because to build an anonymous response a redirect seems to be the most straightforward solution.