10, ); if (user_access('administer media') || user_access('edit media')) { $plugins['upload'] = array( '#weight' => -10, ); } return $plugins; } /** * Implements hook_media_browser_plugin_view(). */ function media_media_browser_plugin_view($plugin_name, $params) { $path = drupal_get_path('module', 'media'); $params += array( 'types' => array(), 'multiselect' => FALSE, ); // The multiselect parameter is a string. So we check to see if it is set and // adjust the local variable accordingly. if ($params['multiselect'] != 'false' && $params['multiselect'] !== FALSE) { $params['multiselect'] = TRUE; } $redirect = array('media/browser', array('query' => array('render' => 'media-popup'))); switch ($plugin_name) { case 'upload': $attached = array(); if ($params['multiselect'] && module_exists('plupload')) { $upload_form_id = 'media_add_upload_multiple'; $attached['js'] = array($path . '/js/plugins/media.upload_multiple.js'); } else { $upload_form_id = 'media_add_upload'; } module_load_include('inc', 'media', 'includes/media.pages'); $upload_form = drupal_get_form($upload_form_id, $params); return array( '#title' => t('Upload'), 'form' => array($upload_form), '#attached' => $attached, ); break; case 'library': return array( '#title' => t('Library'), '#attached' => array( 'js' => array( $path . '/js/plugins/media.library.js', ), 'css' => array( //@todo: should move this. $path . '/js/plugins/media.library.css', ), ), '#settings' => array( 'viewMode' => 'thumbnails', 'getMediaUrl' => url('media/browser/list'), // We should probably change this to load dynamically when requested // via the JS file. ) + $params, '#markup' => '