You are here

function media_media_browser_plugin_info in D7 Media 7.2

Same name and namespace in other branches
  1. 7.4 media.media.inc \media_media_browser_plugin_info()
  2. 7 media.media.inc \media_media_browser_plugin_info()
  3. 7.3 media.media.inc \media_media_browser_plugin_info()

Implements hook_media_browser_plugin_info().

File

./media.media.inc, line 11
Media module integration for the Media module.

Code

function media_media_browser_plugin_info() {
  $info['upload'] = array(
    'title' => t('Upload'),
    'weight' => -10,
    'class' => 'MediaBrowserUpload',
  );

  // Add a plugin for each View display using the 'media_browser' display type.
  $view_weight = 10;
  foreach (views_get_enabled_views() as $view) {
    foreach ($view->display as $display) {
      if ($display->display_plugin == 'media_browser') {
        $title = $display->display_title;
        if (!empty($display->display_options['title'])) {
          $title = $display->display_options['title'];
        }
        $info["{$view->name}--{$display->id}"] = array(
          'title' => $title,
          // @TODO make this configurable.
          'weight' => $view_weight++,
          'class' => 'MediaBrowserView',
          'view_name' => $view->name,
          'view_display_id' => $display->id,
        );
      }
    }
  }
  return $info;
}