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