I’m extending a plugin that get/set it’s content from/to a Database. I would like to edit the values directly on the panel but I’m getting “Cannot convert undefined or null to object” when I try to handle a blocks field.
Inside my vue component:
<k-form v-model="text" @input="input" @submit="saveText" :fields="{
description: { #this works well / simple text store in database
label: 'Description',
type: 'textarea',
width: '1/2'
},
test: { # Cannot convert undefined or null to object
label: 'test',
type: 'blocks',
width: '1/2'
},
}" />
Inside the database, I’ve stored the following for the test Blocks field:
[{"content":{"level":"h2","text":"Title Heading"},"id":"a762ed45-7c56-4fdf-a632-9ed561b6f768","isHidden":false,"type":"heading"},{"content":{"text":"<p>Hello world<\/p>"},"id":"29501507-7dff-4ea5-9915-9bf16f11f175","isHidden":false,"type":"text"}]
The data are retrieved like this:
$text_arr[$text->id()]['description'] = $text->description(); #work as expected
$text_arr[$text->id()]['test'] = $text->test(); #doesn't work...
I’m missing something with $text->test(); ? Do I need to convert the string?
Or I’m storing a wrong set of data inside the database?
Please, could you point me in right direction?