1

What is the best way to add additional text fields to the image module, other than the title and alt value, when adding/ editing content? Is there a module which already does this?

Edit

I've read through Add custom fields to image field and unfortunately this fella got stuck and I guess this was at 7 times. The fieldable files module is no big help. It does a lot of magic but it doesnt effect images added via node entity form.

3

Image is a file entity and to make it fieldable you can use this module:

File Entity (fieldable files)

From the documentation:

File Entity

The File entity module extends the capabilities of the core File module.

File Entity defines 5 File Types - Application, Audio, Image, Text, Video. The Media module adds an additional File Type - Other (currently these File Types are hard coded and cannot be changed).

When files are uploaded they are automatically assigned the appropriate File Type based on the file suffix.

The File Types as currently defined are:

Images - .png, .gif, .jpg, .jpeg, .ico Videos - .mov, .mpg, .flv, .m4v, .mp4, ,ogg, .ovg, .wmv Sound files - .mp3 Text - .txt Document files - .doc, .xls, .pdf, .ppt, .pps, .odt, .ods, .odp Other - ??

Each File Type can have fields. This allows for additional information to be stored along with a media file such as Title, Description, Taxonomy References, Node References, Location, Date created, License information etc.

  • unfortunately this doesnt work. you can actually add files under /file/add, but you wont see your custom fields when adding images inside nodes (the linked thread says so, also) – Alex Aug 1 '16 at 15:06
  • You changed the question after I answered. For this you need another field widget in the node form. For file there is "Editable file" included in the module. A combination for image and editable file was as far as i know in d7 in the media module. I don't know if this is ready for d8 yet. – 4k4 Aug 1 '16 at 15:27
  • But even if you can't find the widget to edit the image fields inline you can edit them in /file/[id]/edit – 4k4 Aug 1 '16 at 15:37
  • I've just tested it, the widget "Editable File" provided by this module works. Also with images. To use it you have to configure the widget in the content type. Then you can go in the node form, add a new image to your node and fill in the custom fields by clicking on the button, that appears right beside the file. But you loose the preview of the image. So you have to choose between those two options, custom inline fields or image preview, – 4k4 Aug 1 '16 at 20:29
  • Nice answer @4k4, as usual :) Yes, editable files should also work for images. For completeness, the alternative option is Media Entity, which instead of making images fieldable, offers an intermediate entity between the node and the actual file. And then you add fields there. The advantage is that it is more flexible. One "media" element can be a single image or video, but also a youtube video, tweet or a whole image gallery. You pretty much need a bunch of ther modules too, like entity browser and inline entity form to properly use it. – Berdir Aug 1 '16 at 20:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.