sylvainjule / kirby-embed

Embed field for Kirby 3 and 4.
74 stars 3 forks source link

Storing field from the frontend #13

Closed squareclouds closed 1 year ago

squareclouds commented 1 year ago

I am trying to use the field from the frontend, but I have the feeling this will not work? it appears that even if i set the input varibale somehow (right now i am doing it by hand before i update my forms) the plugin wont work unless media: [ ] is also populated? which would mean to code the plugin again for the frontend, if i understand correctly?

is there a way aorund this? could I save the URL via frontend form and then with some hook make the plugin retrieve all the info that it needs?

squareclouds commented 1 year ago

@tristantbg thank you for checking the instagram bug. now that everything works (even tiktok and soundcloud and spotify! everything i need!) i would love to store the field from the frontend, but again, my above problem persists.

do you have any idea on how i could do it? i am a designer with ok coding knowledge, so this is a bit too complex for me, i think.

but..

i saw you have the route

'kirby-embed/get-data'

in your api. can i call it from the frontend using a user that has no panel access? my frontend users have only frontend access

squareclouds commented 1 year ago

PS: for the time being i am using a workaround. i created my own regular route (not api route) and copied your route code :) i tested it very quickly but i get a response for the media array

bnomei commented 1 year ago

@sylvainjule i ran into this feature request as well when trying to migrate a regular url to your embed plugin. being able to request the sync data manually would really be helpful.

tristantbg commented 1 year ago

Hi @bnomei and @squareclouds,

I added a new site method called getEmbedData() :

$site->getEmbedData($url);

squareclouds commented 1 year ago

@squareclouds thanks so much! :)

squareclouds commented 1 year ago

excellent, works like a charm!