If I create a tag extension like this:
$parser->setHook('foobar', 'myCallback');
function myCallback($input, $args, $parser, $frame) {
return 'hello world';
}
can the callback "myCallback" efficiently detect the name of the parser tag,
"foobar", that invoked it?
The business problem is this: I use the same callback with 20 different tag names, and
I'd like the behavior to change slightly depending on which tag name was used. (The
tag names are the names of database servers in my company, and the callback accesses the
particular database.)
Right now I am using a very inefficient solution: dynamically creating 20 callbacks (one
for each tag name), each with slightly customized behavior. I'd rather do it with one
callback.
I realize this would be easy if I'd used a single tag name plus a variable argument,
but it's too late to make that change. (The tags have been used 10,000 times and are
widely known in our company.)
Thank you very much.
DanB
ps: I asked this a few years ago, when the answer was "no," but maybe things
have changed by now.....