New answers tagged

4

Never use $response->send() under any circumstances. This results in unpredictable behavior and might fail in different environments, when moving from dev to prod, for example, or in future updates, like it did for Drupal 9.2. The correct method depends on where you want to use it: In a controller: return $this->redirect('user.page'); In a form ...


3

Using redirects with $response->send() like this used to work: $response = new RedirectResponse($url); $response->send(); But, this no longer works in Drupal 9.2. Also, it breaks JSON:API in versions before 9.2. The correct way to do it is described in detail in this excellent answer. Basically, you need to create your own custom http_middleware ...


Top 50 recent answers are included