I’m still working on custom form plugin for the panel and I’m stuck on this : I try to get image from the page then display it and create DIV over it (comics balloons)
but in Vue component, a simple console.log() return an empty array and using it in the template throw me an error : Undefined array key 0 in file: …/site/plugins/gdt-case/index.php line: 7
Trying to understand what you are doing there. I guess you want to create a field that listens to the value of another field as this changes.
For one thing, the props are not the right place to do this, their purpose is to define the field options, so you would need a computed value. But still, when the page is created, your image field will be empty and you will get an error anyway.
However, if I am correct and you want to fetch the image as it changes, before the page is ever saved. This can only be done on the client side, in your Vue component.
indeed I try to get the image from the sibling field. Real-time is an great enhancement but not necessary.
So clearly speaking, I try to get the image stored in the field next to mine (at least url) then I can work over it in my vue component and save coordnates.
My goal is not to transform the image but just displaying it as a background to draw coordnates over it.
but the downside of this approach is that the image won’t change when you change the image, and you need to reload the page after selecting your image for the first time, because the PHP part happens server-side and has no knowledge about what’s going on in your frontend.
No. But you should post your full code to enable us to reproduce your issue. I tested the code above before posting it here. Also make sure that your field name is correct.
with static content like ‘foo’ everything works perfectly. I can get properly, my computed or prop items. I can even get data from blueprint (as custom label for example)
Var dump works well in php and gives images url… (before vuejs)
→ still can’t obtain nothing but an empty array in my vue.js component…
And unfortunately, the result is the same with the code you proposed…
Here is my blueprint :
chapter_pages:
label: Chapter pages
type: structure
fields:
chapter_page_transition:
...
chapter_page_transition_url:
...
chapter_page_transition_fade_type:
...
chapter_page_transition_fade_speed:
...
chapter_page_image:
label: Image
type: files
layout: cards
multiple: false
chapter_page_case:
type: case
label: Draw ballons over the image
chapter_page_balloons:
label: Balloons
type: structure
fields:
chapter_page_balloon_text:
label: Text
type: writer
chapter_page_balloon_xstart:
label: Start Horizontal
type: number
width: 1/4
chapter_page_balloon_ystart:
label: Start Vertical
type: number
width: 1/4
chapter_page_balloon_xend:
label: End Horizontal
type: number
width: 1/4
chapter_page_balloon_yend:
label: End Vertical
type: number
width: 1/4
Ah, ok, you do it differently via the formfields, probably because your fields live inside a structure field, so you would have to fetch the image of the the same structure field item, hm…