Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter4 - Event pass by ???
#1

Started to test a few things in CI4 and was wondering what the best way to handle modifying the input to a Event.
Seems to me perhaps just passing the values by reference might solve the problem?

PHP Code:
public static function trigger($eventName,&...$arguments): bool 

For example if I have:


PHP Code:
$a 'this is something a trigger needs to modify maybe (let the trigger figure it out)';

$boolean = events::trigger('modify_text',$a); 


What would be the best way to modify the $a text value? What if I have multiple modify_text triggers with multiple priority levels? Shouldn't everyone in "[font=Monaco, Consolas, Courier, monospace]priority" be able to take a shot at it? maybe 1 trigger adds <p> if it contains "this" as the first word and then later down the event "list" it adds <b> if it doesn't already start with a html element. [/font]

[font=Monaco, Consolas, Courier, monospace]Like I wrote about prefixing the trigger functions ...$arguments with & should do the trick???[/font]

I look forward to your input.

DMyers
Reply


Messages In This Thread
CodeIgniter4 - Event pass by ??? - by dmyers - 10-01-2018, 08:41 AM
RE: CodeIgniter4 - Event pass by ??? - by dmyers - 10-02-2018, 06:57 AM
RE: CodeIgniter4 - Event pass by ??? - by falko - 10-02-2018, 01:00 PM
RE: CodeIgniter4 - Event pass by ??? - by dmyers - 10-03-2018, 06:18 AM
RE: CodeIgniter4 - Event pass by ??? - by dmyers - 10-03-2018, 11:43 AM
RE: CodeIgniter4 - Event pass by ??? - by dmyers - 10-03-2018, 12:38 PM
RE: CodeIgniter4 - Event pass by ??? - by dmyers - 10-08-2018, 07:55 AM
RE: CodeIgniter4 - Event pass by ??? - by abrkof - 01-04-2020, 09:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB