1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
c304a780
|
Assos Assos
|
|
3 |
85ad3d82
|
Assos Assos
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Contains the default style plugin.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Default style plugin to render rows one after another with no
|
10 |
|
|
* decorations.
|
11 |
|
|
*
|
12 |
|
|
* @ingroup views_style_plugins
|
13 |
|
|
*/
|
14 |
|
|
class views_content_plugin_style_ctools_context extends views_plugin_style {
|
15 |
c304a780
|
Assos Assos
|
public $rows = array();
|
16 |
85ad3d82
|
Assos Assos
|
|
17 |
|
|
/**
|
18 |
|
|
* Render the display in this style.
|
19 |
|
|
*/
|
20 |
c304a780
|
Assos Assos
|
public function render() {
|
21 |
85ad3d82
|
Assos Assos
|
if (!empty($this->view->display_handler->previewing)) {
|
22 |
|
|
return parent::render();
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
$this->rows = array();
|
26 |
|
|
$this->groups = array();
|
27 |
|
|
if ($this->uses_row_plugin() && empty($this->row_plugin)) {
|
28 |
|
|
vpr('views_plugin_style_default: Missing row plugin');
|
29 |
|
|
return;
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
// Some engines like solr key results on ids, but rendering really expects
|
33 |
|
|
// things to be keyed exclusively by row index. Using array_values()
|
34 |
|
|
// guarantees that.
|
35 |
|
|
$this->view->result = array_values($this->view->result);
|
36 |
|
|
|
37 |
|
|
// Group the rows according to the grouping field, if specified.
|
38 |
|
|
$sets = $this->render_grouping($this->view->result, $this->options['grouping']);
|
39 |
|
|
|
40 |
|
|
// Render each group separately and concatenate. Plugins may override this
|
41 |
|
|
// method if they wish some other way of handling grouping.
|
42 |
|
|
$output = '';
|
43 |
|
|
foreach ($sets as $title => $records) {
|
44 |
|
|
foreach ($records as $row_index => $row) {
|
45 |
|
|
$this->view->row_index = $row_index;
|
46 |
|
|
$this->rows[$row_index] = $this->row_plugin->render($row);
|
47 |
|
|
$this->groups[$row_index] = $title;
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
unset($this->view->row_index);
|
51 |
|
|
return $this->rows;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
} |