triggerFilter in Event - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29) +--- Thread: triggerFilter in Event (/showthread.php?tid=72311) |
triggerFilter in Event - eterv - 12-03-2018 I added below new method code in Events\Events.php PHP Code: /** PHP Code: public function test_method() Because I need something similar to the filter that Wordpress uses. What do you think about this? Please, let me know your opinions. RE: triggerFilter in Event - kilishan - 12-03-2018 Interesting idea, but it has a very real problem that filters expect to be able to modify the request/response or return their own response, and calling a filter within an event negates all of those abilities. The filter you are trying to replicate from Wordpress is fundamentally different enough from the Controller Filters that CI provides that I don't think they're compatible. To allow filters on content, you'd be better served creating something new and specific for that use, I think. RE: triggerFilter in Event - eterv - 12-03-2018 (12-03-2018, 06:56 AM)kilishan Wrote: Interesting idea, but it has a very real problem that filters expect to be able to modify the request/response or return their own response, and calling a filter within an event negates all of those abilities. Thank you for your opinion. For now, I think I'll have to use above code I added. That is a quite simple way, if there isn't another simple awesome way. By the way, CI4 Events concept is very nice. I think this is similar to Action (Hook) concept of WordPress. So, I just added that triggerFilter (Filter Hook) function. |