$page->create or/and structure($data, $page, $key)

as described here:


i’d like to add a structured field content to my page but cannot get it done. even when just taking the example it will not add the structure field to my page.

is there any way to add the structure with the $page->create() command?


i cannot seem to format the values the right way to get it saved as an structured field either way.

Any help appreciated.

Check out this post: Add method to append to structure field

I don’t know what your code looks like, but my guess is that you are not setting the value as a YAML string. The actual value stored for structured fields is a string like for all other fields, it just “happens to be” a YAML formatted string.

You can convert your PHP arrays to YAML with the yaml::encode function.

Edit: clearly I was too slow :wink: the post linked by texnixe already says it all