Wikimedia Developer Support

Passing parameters to parser function

Hi,

is there a way how to pass ALL template parameters to parser function at the same time?

E.g. I would like to have template with a lot of optional named parameters, called in page:

{{tplname|arg1=…|arg2=…|arg3=…}}

And I want to pass all parameters - as an array or object - ONE verification parser function

Call in this template should look like as:

{{#verifyArgs: $allargs }}

Can someone help me with this?
Thanks.

I don’t know the answer, but I guess it should be possible, since Scribunto is able to get all parameters from the template without passing them explicitly to the {{#invoke:}} parser function.

Yeah, you’d need to create a wrapper Scribunto module which collects all parameters from the frame object and then constructs the parser function call. Or, if declaring the parser function is up to you, set it up with the SFH_OBJECT_ARGS flag, so it can access the frame object directly.

Thanks!!! I did some experiments and it really works!