You are here

function media_browser_plus_views_plugins in Media Browser Plus 7.3

Implements hook_views_plugins().

Generate a list of which base-tables to enabled the plugins for.

File

views/media_browser_plus.views.inc, line 46
Provide Views data and handlers for media.module.

Code

function media_browser_plus_views_plugins() {
  $plugins = array();
  $path = drupal_get_path('module', 'media_browser_plus') . '/views';

  // Always allow the actual file-table.
  $base = array(
    'file_managed',
  );
  if (module_exists('search_api')) {

    // If the Search API module exists, also allow indices of the file-entity
    // that has the fid field indexed.
    $indices = search_api_index_load_multiple(NULL);
    foreach ($indices as $machine_name => $index) {
      if ($index->item_type == 'file' && isset($index->options['fields']['fid'])) {
        $base[] = 'search_api_index_' . $machine_name;
      }
    }
  }

  // Style plugin.
  $plugins['style']['media_browser_plus'] = array(
    'title' => t('Media browser plus'),
    'help' => t('Displays rows as an HTML list including the folder management.'),
    'handler' => 'media_browser_plus_views_plugin_style_media_browser',
    'theme' => 'media_browser_plus_views_view_media_browser',
    'theme path' => $path,
    'base' => $base,
    'uses row plugin' => TRUE,
    'uses row class' => FALSE,
    'uses options' => TRUE,
    'uses fields' => TRUE,
    'type' => 'normal',
    'help topic' => 'style-media-browser',
  );
  return $plugins;
}