Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Getting original arguments in override
I want to override few methods, some of the have aguments.
I understand how to make override method looking to http://vanillaforums.org/docs/plugins
But Plugin dispatcher calls function with $Sender argument instead of original method aruments.
I understand how to make override method looking to http://vanillaforums.org/docs/plugins
But Plugin dispatcher calls function with $Sender argument instead of original method aruments.
0
Comments
http://markosullivan.ca/garden-preview-part-viii-plugins/
But according to this doc I see that $Arguments are present in Events, but do not see them present in magic methods (I am interested in overrides).
You can, however, use _Create to override an existing method (undocumented; more on that in a moment). In Models, the additional arguments will get passed as parameters I believe:
UserModel_MethodName_Create($Sender, $Arg1, $Arg2, $Arg3)
Called with: $UserModel->MethodName($Arg1, $Arg2, $Arg3);
Conversely, Controllers get their arguments from the URL, which can be accessed with $Sender->RequestArgs inside plugins. That's clearly documented in the master controller (/library/core/class.controller.php).
Overall, I tend to think if you're creating overrides then you're probably not approaching the problem right. Usually when I start with an override I end up rearranging it to use object inheritance or a fired event instead. Not always, but usually.
If the _Create override hacky thing gets written up, I'd include strong wording about preferring fired events. Overriding means you lose additional functionality as it's released into core and could cause you a real headache down the line.
You have to understand the Plugins doc page is written from the perspective of a thesis, not a guide to Plugin devs, because it was meant to get people excited about the idea back in '08. That's probably the 1 page of the docs I'd be most interested in re-writing as I think it's definitely costing us plugin developers.