I am using hook_media_browser_plugin_info_alter() to change the weight of certain plugins to ultimately have the media library be the default tab:

<?php
function hook_media_browser_plugin_info_alter(&$info) {
  $info['upload']['weight'] = 12;
  $info['media_internet']['weight'] = 11;
}
?>

Altered Media Library Tab Order

This was working fine until I updated yesterday to the dev versions of both media and file entity (from http://drupalcode.org/project/file_entity.git/commit/945bf90b283ef56a48b...
and http://drupalcode.org/project/media.git/commit/c49692be4b1e9990bf7b01a8d... versions )

Now, the upload tab is still the default, but after uploading a new file and clicking the "Next" button, the media library tab is again the active tab. I can click back to the Upload tab and am presented with the alt/title fields for my image and I can save and submit the image into my WYSIWYG area from that point, but this process will be confusing for users.

Ultimately, I am wondering if this is a bug or as designed. If this is expected behavior, what is the proper way to change the weight/order of media browser plugin tabs if not using hook_media_browser_plugin_info_alter()?

Could this be related to #1881152: Browser display cleanup?

CommentFileSizeAuthor
#2 1934226-d7-2.patch4.46 KBredndahead
medialibrarytabs.png85.97 KBbneil

Comments

redndahead’s picture

My idea to fix this is to hide the tabs when you move onto step > 1. I'm working on a patch now to do this. What would be helpful is if someone knows how to tell what step you are currently on within the media_browser function.

redndahead’s picture

Title: UX issue during file upload when implementing hook_media_browser_plugin_info_alter() to alter plugin weights » Hide tabs when we are on step > 1
Status: Active » Needs review
StatusFileSize
new4.46 KB

It came to me in a dream, or nightmare, but anywho I have something working. Style is ugly, but works. I'm going to change the title, tell me if this is taking over your issue too much.

bneil’s picture

Title: Hide tabs when we are on step > 1 » Hide tabs when plugins are on step > 1

@redndahead the patch in #2 fixes the problem I identified in the original post. I'm not going to set this to RTBC though since it would be nice if someone closer to the browser code could take a peek.

Thanks redndahead!

chris matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch in #2 does not apply to the latest media 7.x-2.x-dev and if still relevant needs to be rerolled

joseph.olstad’s picture

Status: Needs work » Closed (outdated)

feel free to submit a rerolled patch and I will consider re-openning if you need this and want it reviewed