Overwrite toString method for custom field

I’d like to overwrite the toString method of my custom field so I can modify the output of $page->myfield() without the need of a custom field method. Is that possible somehow?

Registering a custom field seems to always use the Kirby\Content\Field class. I don’t think overwriting the Field class directly is a good idea and I couldn’t find a way of using my own field class.

$field = $page->myfield();
echo get_class($field);
// Kirby\Content\Field

Kirby takes the data from the content file, which does not have any information about the field type. So there are no different field classes possible.

Makes sense. Thank you, Sonja!