I recently ran into an issue when I made a field named image
and used $page->image()
to access it.
Only later, it turned out that image()
is a native Kirby method returning the first image. When there were multiple images uploaded to the page, the problem became apparent, as the first image got returned instead of the image specified in the page’s field.
I had similar issues with naming collisions before. They are always quite annoying, as everything seems to work without errors, so debugging it is hard.
Perhaps Kirby could give some kind of warning (only in development mode) when a field name might collide with a native Kirby method? This would definitely improxe the developer experience for me.
Yes, a warning would be great!