This patch adds $params['activeField'] into media browser settings when calling hook_media_browser_plugin_info() and hook_media_browser_plugin_view().

Comments

dlumberg’s picture

Rerolled patch to include '#delta' for multiple values support in fields.

nedjo’s picture

@dlumberg: could you please explain why this patch is needed? What problem or issue does it address? What does it make possible that wasn't before?

dlumberg’s picture

The media browser didn't get passed any variable or have any record of what field had called it.
It's useful for library plugins so that they can be customized per field instead of globally.

dave reid’s picture

Component: Code » Media Browser
arthurf’s picture

@dlumberg - we might want to consider holding on this until the JS for the modals is worked out on 7.x-2.x

JacobSingh’s picture

Status: Needs review » Closed (duplicate)

I'm not so keen on this. Ideally, the media browser has no knowledge of what called it. However, I see nothing wrong with passing along that information simply as metadata for other plugins to use.

In that vein, I'm marking this a dupe of implementing ctools plugins which should allow this kind of functionality.
#1139514: Overhaul the media browser code to not use an iframe, and be more understandable, maintainable, and extendable
doesn't describe it well, but there is something in there about ctools plugins.

I made a new issue specifically for it:
#1289872: Use ctools plugins to provide add-ons to the media browser

With ctools plugins, plugin authors will be able to pass whatever information they want more easily.