I have a field image called "getFromFlickr". Via hook_field_widget_info(), I create a piece of form that (when in edit/create node), build a modal, call flickR, get one image, save the file in the database with system_retrieve_file(), and finally I have a standard file stdClass object. How can I get its FID and put it in the original image field "getFromFlickr"?

  • Input type? You meant field widget? or field data? Because one thing I'm certain from your text you don't want to change is the type (it's image field and you want image). – Mołot Jul 15 '15 at 12:59
  • @kiamlaluno: why do you have edited my question ? This is not my question and no this is not the sense of my question!!! I know how to get FID from file object,($file->fid). I know how to put this fid into form via js! And via hook_field_widget_info() I can not create no1 form. – ZioBudda Jul 15 '15 at 21:05
  • @Molot yes, I don't want to change field type, but only how the field is showed in the create/edit form. – ZioBudda Jul 15 '15 at 21:08
  • Taken from your original version: "how can I get this fid and put into the original image field "getFromFlickr" ?" I didn't change the meaning of the question. What the question says it's what you called example. – kiamlaluno Jul 16 '15 at 5:05
  • A widget changes the way the field data are output, or the way the field data are asked to the user; it doesn't change the way the field works. If that were the case, Drupal would not have an image upload field, but just a file upload field. – kiamlaluno Jul 16 '15 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.