Thanks, Brian! I tried it out, and that worked great. Somehow I never
thought to check how other extensions do it...
On Mon, Feb 15, 2021 at 9:09 PM Brian Wolff wrote:
> You need to call $frame->expand( $argument ) on each argument value to get
> the actual value. #if is an example of doing
You need to call $frame->expand( $argument ) on each argument value to get
the actual value. #if is an example of doing this
https://github.com/wikimedia/mediawiki-extensions-ParserFunctions/blob/master/includes/ParserFunctions.php#L118
.
This structure is to allow dead code elimination. Any
Hi Brian,
Thank you! That... mostly worked. I added SFH_OBJECT_ARGS
to setFunctionHook(),and then the new $frame value passed in was indeed
easy to use - I just had to call $frame->getArgument('ParameterName')" to
get the value for that template parameter.
Unfortunately, now I don't know how to
I think what you have to do is set the SFH_OBJECT_ARGS flag in the third
argument of setFunctionHook.
That will change the function signature of your callback to ($parser,
$frame, $args). Note that $args might no longer be an array of strings but
PPNode (or something) stuff you may have to call
Hi,
When you have a parser function called from within a template, you can of
course pass in to it any template parameters, like:
{{#flagicon:{{{Flag image|}}} }}
(This is a silly example, but bear with me.) I would like to instead be
able to call the parser function without the parameter, like