Replies: 1 comment 3 replies
-
Glad you like it. I'm trying to understand how your case should work. Let's say that your tag is named $configurator = new s9e\TextFormatter\Configurator;
$configurator->BBCodes->addCustom('[x id={INT}]', '');
$configurator->tags['X']->attributes['id']->filterChain->append('validateId');
function validateId(int $id)
{
return ($id === 1);
}
extract($configurator->finalize());
$text = '[x=1] [x=2]';
$xml = $parser->parse($text);
die("$xml\n"); <r><X id="1">[x=1]</X> [x=2]</r> Do you want to run a function with all IDs (so an array such as |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello 👋🏼,
First of all, incredible library! I read through the docs and couldn't find what I'm looking for so not sure if it's possible or not, but wanted to ask away.
Basically, I have a tag configured with an
ID
attribute and a regular expression to extract it from, and I'm running a filter on this tag where theID
is used to identify a database model and validate the tag depending on its existence. What I'm trying to do is run another filter first, but run it on all tag instances before running the other filter on all of them again so that I can collect the caught IDs first before doing anything. I might've missed something very simple here but oh well.Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions