Hey - maybe I’m blind, but I didn’t find a build-in-solution in the docs or in this forum to a get a specific entry from a structure field. For example I use the structure field to create a dictionary like:
// blueprints/site.yml
dictionary:
type: structure
fields:
key:
type: text
value:
type: text
Now, in the templates I would like to have a method to get a specific entry by key like this:
In the meantime I found another solution I like to share. Maybe it is working out for someone too.
I converted the indexed array from the structure field (via ->yaml()) into an associated array. After that, i got the shortest way to access a value by a key:
I stored $associativeDictionary in the controller/site.php and have easy access to all entries everywhere – including “nice” errors, if a key is not defined