Projet

Général

Profil

Paste
Télécharger (1,25 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / media / includes / media_views_plugin_style_media_browser.inc @ e4215af7

1
<?php
2

    
3
/**
4
 * @file
5
 * The media browser style plugin.
6
 */
7

    
8
/**
9
 * Media Views style plugin.
10
 *
11
 * Style plugin to render media items as an interactive grid for the media
12
 * browser.
13
 *
14
 * @ingroup views_style_plugins
15
 */
16
class media_views_plugin_style_media_browser extends views_plugin_style_list {
17

    
18
  /**
19
   * Stores the files loaded with pre_render.
20
   */
21
  public $files = array();
22

    
23
  /**
24
   * Set default options.
25
   */
26
  function option_definition() {
27
    $options = parent::option_definition();
28

    
29
    $options['type'] = array('default' => 'ul');
30
    $options['class'] = array('default' => 'media-list-thumbnails');
31
    $options['wrapper_class'] = array('default' => '');
32

    
33
    return $options;
34
  }
35

    
36
  /**
37
   * Prevents a problem with views when get_row_class() is not set.
38
   */
39
  public function get_row_class($row_index) {
40
  }
41

    
42
  /**
43
   * Add the base field (fid) to the query.
44
   */
45
  public function query() {
46
    if (method_exists($this->view->query, 'add_field')) {
47
      // Normal file_managed based view.
48
      $this->view->query->add_field($this->view->base_table, $this->view->base_field);
49
    }
50
    if (method_exists($this->view->query, 'addField')) {
51
      // Search API based view.
52
      $this->view->query->addField('fid');
53
    }
54
    parent::query();
55
  }
56

    
57
}