In the current D7 Flag module, you are unable to flag media uploaded by the Media module. Is this something that can be done with a work around? Is this a feature that needs to be implemented? Thanks

Comments

quicksketch’s picture

Project: Flag » D7 Media
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Flag core » Code

Is this something that can be done with a work around?

Flag can flag anything with a unique numeric ID, including Media items (which are really just entries in the "file" database table). However, no implementation of this ability yet exists.

Is this a feature that needs to be implemented?

Yes, but I don't think it will exist in Flag core, which provides flagging for core objects only, such as nodes, users, and comments. We don't directly support Taxonomy terms either (though Flag Terms module corrects that), considering I think the 90% use-case is already met by what flag provides out-of-box.

Considering Media module provides all the UI and hooks for implementing media objects, it should provide the Flag integration also; or it should be a separate project.

JacobSingh’s picture

Thanks Nate,

bmx269: If you want to write a separate module that would be an awesome contribution! Media itself is getting a little bulky, although if it is small enough it might be worth having it in media itself.

Best,
Jacob

bmx269’s picture

The reason for wanting this feature, is so media items, such as images, can be bookmarked, liked, etc, and or other features that the flag module can provide for nodes, then in turn specific views of such things could be built.

Are there any other things that would need to be specified from a Flag or Media point of view?

JacobSingh’s picture

bmx269: Why don't you check out the flag module and the node facility for it, cut and paste and try to make it work w/ media. Send up a patch and then we can decide if it belongs in the core module or an add-on (I'm thinking the latter).

@quicksketch if you're listening, making flag non-node centric would be awesome. do you think that's in the cards for the D7 version? (flag_entity?)

Best,
Jacob

quicksketch’s picture

Flag is already not node-centric, it just so happens to include implementations for nodes, comments, and users by default. Flag can flag anything with an ID, it's not tied to nodes in any way. In the case of these objects, it makes sense to include them because Drupal core already has locations and UIs in which Flag can provide options for flagging, either in the "view" version of these things or on the edit form as a checkbox. Individual files however do not have a location in which they are displayed or edited individually and in a central place, with the exception of Media or some kind of file browser like IMCE, though IMCE is quite a bit off the mark as far as editing file properties goes so far.

quicksketch’s picture

Regarding flags as fields and/or an entities, see #871064: Making flaggings fieldable.

aaron’s picture

makes sense to me to have this. @quicksketch: does flag automatically load module includes as needed? in which case it seems to me like the feature could be made light-weight enough to add to the main module. even if we decide against that, it should still probably be packaged with this module. i can't imagine that it'll be too large an addition (of course, i'm probably sticking my foot in my mouth...)

aaron’s picture

or wait, doesn't d7 handle automatic file included loading as needed? i need to just shut up and look myself. in the morning... :P

quicksketch’s picture

It doesn't look like Flag actually auto-loads classes in any way currently. It'd be a simple fix however to add a 'file' property to hook_flag_definitions(). For an example of creating your own flag class, I suggest just looking at the code for Flag Terms, which is a good stand-alone example implementation.

arthurf’s picture

Status: Active » Closed (won't fix)

This is a request for a new module, closing until somebody wants to write it.

MickC’s picture