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.
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
Comment #1
quicksketchFlag 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.
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.
Comment #2
JacobSingh CreditAttribution: JacobSingh commentedThanks 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
Comment #3
bmx269 CreditAttribution: bmx269 commentedThe 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?
Comment #4
JacobSingh CreditAttribution: JacobSingh commentedbmx269: 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
Comment #5
quicksketchFlag 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.
Comment #6
quicksketchRegarding flags as fields and/or an entities, see #871064: Making flaggings fieldable.
Comment #7
aaron CreditAttribution: aaron commentedmakes 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...)
Comment #8
aaron CreditAttribution: aaron commentedor wait, doesn't d7 handle automatic file included loading as needed? i need to just shut up and look myself. in the morning... :P
Comment #9
quicksketchIt 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.
Comment #10
arthurf CreditAttribution: arthurf commentedThis is a request for a new module, closing until somebody wants to write it.
Comment #11
MickC CreditAttribution: MickC commentedTry http://drupal.org/project/flag_files