- Drupal 8 Module Development
- Daniel Sipos
- 141字
- 2021-07-02 12:22:42
Event Dispatcher and redirects
A common thing you'll have to do as a module developer is to intercept a given request and redirect it to another page, and more often than not, this will have to be dynamic, depending on the current user or other contextual info. Drupal 7 developers know very well that this has always been an easy task. Simply implement hook_init(), which gets called on each request and then use the famous drupal_goto() function. This, however, is no longer the case in Drupal 8. What we have to do now is subscribe to the kernel.request event (remember this from the preceding chapter?) and then change the response directly. However, before seeing an example of this, let's take a look at how we can perform a simpler redirect from within a Controller. You know, since we're on the subject.
- Instant Node Package Manager
- Android項目開發入門教程
- CockroachDB權威指南
- 兩周自制腳本語言
- Android開發精要
- CentOS 7 Server Deployment Cookbook
- TestNG Beginner's Guide
- 從程序員到架構師:大數據量、緩存、高并發、微服務、多團隊協同等核心場景實戰
- 編寫高質量代碼:改善C程序代碼的125個建議
- 你必須知道的204個Visual C++開發問題
- 機械工程師Python編程:入門、實戰與進階
- 從學徒到高手:汽車電路識圖、故障檢測與維修技能全圖解
- C語言課程設計
- Learning FuelPHP for Effective PHP Development
- AIRIOT物聯網平臺開發框架應用與實戰