Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If selecting a previous file, we'll be given a FID. We need to send the FID to the appropriate registered media hook to handle. For instance, if our element is an Attachment, it would go to Media Upload. Filefields would go to Media FileField, etc.
The appropriate resource field hook would need to handle it from there. For instance, Media Upload will need to store the FID in the node's ->attachment array, Media FileField into ->field_xyz[0]['fid'], etc.
Comments
Comment #1
aaron CreditAttribution: aaron commentedwe now get the file, which needs to be processed at media_browser_submit in the media.module.
Comment #2
jmstacey CreditAttribution: jmstacey commentedThe FID is currently not available at media_browser_submit for passing on to the registered handler. I plan to change the file list to use the FID rather than the filepath as the key after taking care of #480146: Move Media Hook Implementations out of media.module.
See also #480166: hook_media_action [actions and chaining], a Discussion on implementation which directly affects work done in this area.
Comment #3
aaron CreditAttribution: aaron commentedfixed