Hi! Is there an in-built possibility to access the attrs[]
array of the editor field? I know there’s the attrs()
, however I’m not sure on how to use it https://github.com/getkirby/editor/wiki/Block-object
I’m trying to get the src
element of the editor field’s array in
Covervideo:
[
{
"attrs": {
"src": "https://vimeo.com/example",
"caption": ""
},
"content": "",
"id": "_0z7rixs4n",
"type": "video"
}
]
I tried $page->covervideo()->attrs()->src()
but I guess this isn’t how the attr()
is supposed to be used.
Foreach
-looping $page->covervideo()->attrs() as $attr
returns the whole array (as string, I guess) instead of single elements.
Do I have to access it via JSON?
Thanks for any tips!