1 |
85ad3d82
|
Assos Assos
|
<?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 |
|
|
// Stores the files loaded with pre_render.
|
19 |
|
|
public $files = array();
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* Set default options.
|
23 |
|
|
*/
|
24 |
|
|
function option_definition() {
|
25 |
|
|
$options = parent::option_definition();
|
26 |
|
|
|
27 |
|
|
$options['type'] = array('default' => 'ul');
|
28 |
|
|
$options['class'] = array('default' => 'media-list-thumbnails');
|
29 |
|
|
$options['wrapper_class'] = array('default' => '');
|
30 |
|
|
|
31 |
|
|
return $options;
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
/**
|
35 |
|
|
* Prevents a problem with views when get_row_class() is not set.
|
36 |
|
|
*/
|
37 |
|
|
public function get_row_class($row_index) {
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
/**
|
41 |
|
|
* Add the base field (fid) to the query.
|
42 |
|
|
*/
|
43 |
|
|
public function query() {
|
44 |
|
|
if (method_exists($this->view->query, 'add_field')) {
|
45 |
|
|
// Normal file_managed based view.
|
46 |
|
|
$this->view->query->add_field($this->view->base_table, $this->view->base_field);
|
47 |
|
|
}
|
48 |
|
|
if (method_exists($this->view->query, 'addField')) {
|
49 |
|
|
// Search API based view.
|
50 |
|
|
$this->view->query->addField('fid');
|
51 |
|
|
}
|
52 |
|
|
parent::query();
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
} |