I'm working on "porting" the media_browse_plus module (folders branch) to the latest dev of media. While doing so I struggled over this jQuery selector for the action-links in the admin ui:
// Configure the "Add file" link to fire the media browser popup.
$('ul.action-links li', context).remove();
Unfortunately this selector removes not only the "Add file" link but all potential action-links.
I suggest we change the selector to this to avoid that:
// Configure the "Add file" link to fire the media browser popup.
$('ul.action-links li', context).has('a.media-launcher').remove();
This way the links of other modules will stay untouched.
Comments
Comment #2
Sebastian.Buesing commentednot quite there yet:
Thats what I get with the patch :-)
Comment #3
dlumberg commentedCheck this out http://drupal.org/node/1163100
I think it might accomplish what you're looking for.
Comment #4
das-peter commentedJust struggled over the same thing.
Unfortunately I don't really know from where the links, that should be replaced, come from. The attached patch now replaces them by using the link target. But I'd prefer to replace them by a class or id instead.
If someone has a hint I'll extend the patch.
Comment #5
Sebastian.Buesing commentedDoes now work fine with media_browser_plus!
Comment #6
Pisco commentedRerolled and adapted the patch (
removeversushide).Comment #7
Pisco commentedWhere's the patch??!?! … here it is. Sorry for that!
Comment #8
Pisco commentedWould be nice to have this patch included quickly as it kind of blocks Media browser plus.
Comment #9
Sebastian.Buesing commentedI totally agree with Pisco here and would love to see it committted.
Comment #10
ParisLiakos commentedDont know whether this applies in 7.x-2.x too.
Will give it a check later,but its RTBC for 7.x-1.x
Comment #11
dave reidSo I reviewed #7 and I'm wondering why we need to hide any action links at all? The 'Add file' link does not already exist in local actions, so the only thing this code does is hide the 'Import media' local action.
Someone please test what happens when we just get rid of
$('ul.action-links li', context).hide();because that seems to be the better solution here (and is in line with what the current media.admin.js does in 7.x-2.x).Comment #12
dave reidI tested this with an additional local action of admin/content/media/test-action and it appears and works with the patch in #11.
Comment #13
ParisLiakos commentedTested it and works indeed!
seems i missed Add file's removal from
hook_menu()(cool) !The best solution would be adding an id to this link through the hook_menu() to this link but since this is currently impossible (see #1043906: Document how to possible to add link options when defining local tasks and actions) this is the best solution. thanks Dave
Comment #14
dave reidCommitted #11 to Git. http://drupalcode.org/project/media.git/commit/2008ac5
Comment #15
das-peter commentedAwesome, thank you very much. Now we're definitely heading for the next beta of media browser plus.