My Problem right here is that even when my Text is marked as bolt or italic it will not be formated to the standard kirbytext. Also adding the “->kirbytext()” to the echo wont do it (<?php echo $struc['cost']->kirbytext(); ?>)
The yaml() methods returns an array. Each element of an array is just a string, not a field object, so you can’t use a field method like kirbytext() on it.
This is exactly why I prefer the toStructure method when working with structured fields; it allows you to work with the fluent field API as a natural extension instead of having to fall back onto clumsy PHP array constructs and the Kirby helper functions.
This should do the exact same thing (I have not tested this specific example, but I use that style almost everywhere). I find it much more readable and intuitive.
True. I’m not denying that there’s uses for yaml() - I’ve had some myself. But in a case like what @Timk describes, where the root of the problem is that yaml() doesn’t give him the field that he’d clearly like to have, I feel somewhat obliged to evangelize for the use of toStructure()