Multiple options in one add handler
ideiasfrescas opened this issue · comments
Ideias Frescas, design e multimédia commented
Hello, we will be having a use case when we need to add similar behaviour to a couple of shortcodes, being the only difference, their name. We don't see in the documentation, so we were wondering if its possible to provide an array of possible names or pipe between them?
like so
$facade->addHandler('hello|world', function(ShortcodeInterface $s) {
....
});
or
$facade->addHandler(['hello','world'], function(ShortcodeInterface $s) {
....
});
This would considerably shrink the codebase.
Best regards
Tomasz Kowalczyk commented
Hi @ideiasfrescas, for ShortcodeFacade
this behavior is already covered by addHandlerAlias()
method (see here). Can you use it instead?
Ideias Frescas, design e multimédia commented