Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tamasd/1722887 to your computer and use it in GitHub Desktop.
Save tamasd/1722887 to your computer and use it in GitHub Desktop.
--- media.module
+++ media.module
@@ -435,6 +435,19 @@ function media_page_alter(&$page) {
}
/**
+ * Implements hook_menu_local_tasks_alter().
+ */
+function media_menu_local_tasks_alter(&$data, $router_item, $root_path) {
+ // Even if there aren't any action links on admin/content/media (e.g., if
+ // the user doesn't have 'import media' permission), make menu_local_actions()
+ // not strictly empty, so that Drupal.behaviors.mediaAdmin.attach() has a
+ // container into which to add an "Add file" action link.
+ if ($root_path == 'admin/content/media' && empty($data['actions']['output'])) {
+ $data['actions']['output'][] = array();
+ }
+}
+
+/**
* Implements hook_element_info_alter().
*/
function media_element_info_alter(&$types) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment