In my content type I have a custom widget added to an Image field. I need to open a custom popup when clicking in the image fields 'Choose File' button.

What I actually want to do is change the Image fields behavior like as in Entity Browser. I have created a new widget and added to that Image field, but I have no idea how to change the Choose File button to a button like entity browser.

  • You can't, that button is provided by the browser. You need to use a different widget for an entity browser, the file upload is literally just for uploading files – Clive Jan 8 '19 at 9:24
  • @Clive yes I have created a widget but I have no idea how to change the field into something different like entity browser – i am batman Jan 8 '19 at 10:09
  • Why don't you just use the entity browser widget? you'll probably need to explain in a lot more detail what you've done and what you're trying to achieve to get a good answer – Clive Jan 8 '19 at 10:11
  • @Clive I need to do something like image_widget_crop module. But it doesnt work with entity browser because to work with image_widget_crop the field widget needs to be changed. So I have created similar widget. It does what it needs to do when uploading images. But I need an option to select my previously uploaded images. Its written in js. So I need to trigger my js function when clicking on the image fields button. – i am batman Jan 8 '19 at 10:23
  • Sorry but I doubt anyone's going to be able to understand it from that couple of line description. I'd advise editing the question and providing all the information, code samples, etc, in there – Clive Jan 8 '19 at 10:28

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.