Hello,
I’m trying to create a custom Tag.
Whenever the user enters (contact: unknownValue1)
or (contact: unknownValue2)
or any other value which I’m not aware of yet,
the plugin shall check, if those fields in the contact page exist and if
they contain any information, then return it.
How can I check, if there’s a field of the same name as the tag value?
Kirby::plugin('my/customtags', [
'tags' => [
'contact' => [
'html' => function($tag) {
$contactPage = site()->pages()->find('contact');
$tagValue = $tag->value();
$result = '';
if($contactPage /* && $contactPage -> tagValue -> exists() -> */){
$result = $contactPage -> tagValue -> html();
}
return $result;
}
]
]
]);