Problem/Motivation

The current setup works fine for normal image processing. However, there is no way to apply Form Mode widgets to the image. We utilize the Focal Point module heavily, along with 85K+ other sites. I think it would help the modules viability to provide an image field that can be acted upon in the form mode of the media item.

Proposed resolution

The proposed patch adds an image field, and then sets that field equal to the file ID that is used for the thumbnail metadata. The field is set to hidden on the form and display mode by default, so it won't affect current users experiences. It will, however, allow for more advanced sites to use the before-mentioned form mode widgets like they normally would with other image fields.

Also, while working through this, I noticed the config currently lies in the config/install directory. This will cause errors if you try to uninstall and re-install the module, so I've moved it to the config/optional directory.

Remaining tasks

I'm currently setting the value in a hook_presave. I do believe there is a way to probably set the value when the media item is created, but I haven't yet figured it out. So possibly update the code. Also, I should add documentation to the readme on the extra field since its hidden and may not be immediately obvious.

User interface changes

No changes by default. But an added "Image" field on the manage form display, and manage display tabs.

Data model changes

Added a new field_media_unsplash_image field.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swilmes created an issue. See original summary.

swilmes’s picture

Issue summary: View changes
swilmes’s picture

Issue summary: View changes
batigolix’s picture

Issue tags: +finalist-sprint