| 1 |
<?php
|
| 2 |
// $Id: comment.views_default.inc,v 1.6 2008/06/10 21:30:43 merlinofchaos Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Contains the default summary style plugin, which displays items in an HTML list.
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* The default style plugin for summaries.
|
| 10 |
*
|
| 11 |
* @ingroup views_style_plugins
|
| 12 |
*/
|
| 13 |
class views_plugin_style_summary extends views_plugin_style {
|
| 14 |
function option_definition() {
|
| 15 |
$options = parent::option_definition();
|
| 16 |
|
| 17 |
$options['count'] = array('default' => TRUE);
|
| 18 |
$options['override'] = array('default' => FALSE);
|
| 19 |
$options['items_per_page'] = array('default' => 25);
|
| 20 |
|
| 21 |
return $options;
|
| 22 |
}
|
| 23 |
|
| 24 |
function query() {
|
| 25 |
if (!empty($this->options['override'])) {
|
| 26 |
$this->view->set_items_per_page(intval($this->options['items_per_page']));
|
| 27 |
}
|
| 28 |
}
|
| 29 |
|
| 30 |
function options_form(&$form, &$form_state) {
|
| 31 |
$form['count'] = array(
|
| 32 |
'#type' => 'checkbox',
|
| 33 |
'#default_value' => !empty($this->options['count']),
|
| 34 |
'#title' => t('Display record count with link'),
|
| 35 |
);
|
| 36 |
$form['override'] = array(
|
| 37 |
'#type' => 'checkbox',
|
| 38 |
'#default_value' => !empty($this->options['override']),
|
| 39 |
'#title' => t('Override number of items to display'),
|
| 40 |
);
|
| 41 |
$form['items_per_page'] = array(
|
| 42 |
'#type' => 'textfield',
|
| 43 |
'#title' => t('Items to display'),
|
| 44 |
'#default_value' => $this->options['items_per_page'],
|
| 45 |
'#process' => array('views_process_dependency'),
|
| 46 |
'#dependency' => array('edit-style-options-override' => array(TRUE)),
|
| 47 |
);
|
| 48 |
}
|
| 49 |
|
| 50 |
function render() {
|
| 51 |
$rows = array();
|
| 52 |
foreach ($this->view->result as $row) {
|
| 53 |
// @todo: Include separator as an option.
|
| 54 |
$rows[] = $row;
|
| 55 |
}
|
| 56 |
return theme($this->theme_functions(), $this->view, $this->options, $rows);
|
| 57 |
}
|
| 58 |
}
|
| 59 |
|