Replace "exit" with something else

Created on 8 August 2023, over 1 year ago

Problem/Motivation

Calling an exit almost anywhere in a Drupal module is a bit of a no-no. We don't need this code to live in a field formatter in order to redirect the user to a different URL. An exit stops many other things occuring such as proper teardowns, anything using the DestructableInterface, and I imagine results in some of the other bugs in the queue.

Why not move to something a bit safer, such as a request subscriber similar to redirect module?

That's just one example, but all that really needs to happen is to grab the entity from the request, check it's using the formatter and then perform the redirect.

Thoughts?

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇦🇺Australia acbramley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024