Call field with "-" within there names

Ahoy Kirbyans,
I am implementing a few indieweb features in my site, like microformats, micropub and microsub. But if I use a publisher it creates fields with “-” within there names. For example this:
Repost-of

But I can’t call fields with “-” within. if I do this I will get an error.

This:
$article->Repost-of()

Will get this:
Undefined property: Page::$Repost

(You can have a look at debugger: https://www.niklasjordan.com/blog/notes/)

So, how can I call these fields with a “-” within there names? Are there any solutions for this problem?

You have. to use an underscore, dashes are not allowed in PHP method/function names.

While Kirby puts a dash in the text file, you can just ignore that.

1 Like

It works :wink: What a simple solution! Thanks for your help.