⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How does the callaback functions work?



Carlos Bernal
  • profile picture
  • Member

Posted 27 October 2013 - 20:25 PM

Hello,

 

I need to do some customization to the CRUD. Basically i need to upload multiple files in an Add or Edit Action, and all i'm going to save in the database is the url of the folder that will contain the images.

 

I have been searching the forum, and it seems like I have to do this myself.

 

What i'm doing, is showing multiple upload buttons using the add_field_callbak, and so far so good.

 

The problem is that i also need some custom callback, to save the name and url of the uploaded files.

 

I've been reading the GroceryCRUD source code, and cant figure out how to use or create callbacks. I'm trying to use "call_user_func" for the callbacks, however, it doesn't work because each upload creates a new PHP request, and the variable that saves the user callback is empty in this context.

 

I was wondering if someone could explain me how do the GroceryCRUD callbacks work.

 

Thank you for your time.


Amit Shah
  • profile picture
  • Member

Posted 28 October 2013 - 09:22 AM

Hello Carlos Bernal

 

Welcome to the GC Forum

 

Well there are many solutions ppl have been providing .. custom js / some work out with integrating (GC with IC [ImageCrud]) - that all works out but the best i loved to go with  was this

 

/topic/1912-updated-30072013-multiple-uploading/

 

This truly have worked for me and so will for you.

 

Happy GCing


Carlos Bernal
  • profile picture
  • Member

Posted 28 October 2013 - 16:11 PM

Indeed that post was very useful, thank you very much Amit