I created a custom field which should hold it’s (content) data as array. My content file looks like this:
----
Borrowed-by:
[
{
"id": "news\/1648733763400",
"borrowed_by": {
"community_id": "1_article",
"community_url": "http://localhost:8090/news/1648733763400",
"school_name": "Schule"
"borrowed_on": "2022-05-01 12:33:00"
}
}
]
Allthough the data is being loaded into the model it doesn’t get interpreted as an array but as String. Where do i have to hook my handler to convert the given String into an Array?
Any help is greatly appreciated, Thanks, Thomas E.-E.
thanks, but unfortunately i didn’t get it yet.
I assumed that there is some “magic” wiring of the values being stored in the content file and the props of a field. So in my case the blueprint looks like:
fields:
borrowed_by:
type: borrowedby
label: Ausgeliehen von
empty: Dieser Beitrag wurde bisher noch nicht ausgeliehen.
in index.php
of my plugin i have
'fields' => [
'borrowedby' => [
'props' => [
'value' => function ($value = null) {
I had hoped that $value
carries the value borrowed_by
as String (see my last post). Now i understood that I would than have to take care of converting the string into an Object myself, ok. But $value
is empty.
How could this value filled from the content file?
oh stop … exactly that happend … $value
got filled now and thow the workflow is clear!