I’m trying to get KirbyText links to work so that each link gets a random number added to its class name. So that if there’s a text file with the text ”(mylink: # text: click here class: test)”, the resulting html link would include
or a similar result. I’ve made a plugin based on the KirbyText link, which has this section:
return Html::a($tag->value, $tag->text, [ 'class' => $tag->class, 'rel' => $tag->rel, 'role' => $tag->role, 'title' => $tag->title, 'target' => $tag->target, ]);
I’ve added this in the beginning of the file:
$mynumber = rand(1, 100);
But now I can’t figure the right way to add that random number to the class. Other than that the plugin functions as it should, as it is just a copy of the original, but as soon as I try to add $mynumber to the line
‘class’ => $tag->class,
it doesn’t work anymore. I’ve tried different ways, but with no success so far.
Which would be the correct way?