Go to the documentation of this file.00001 <?php
00012 class views_plugin_style_summary extends views_plugin_style {
00013 function option_definition() {
00014 $options = parent::option_definition();
00015
00016 $options['base_path'] = array('default' => '');
00017 $options['count'] = array('default' => TRUE, 'bool' => TRUE);
00018 $options['override'] = array('default' => FALSE, 'bool' => TRUE);
00019 $options['items_per_page'] = array('default' => 25);
00020
00021 return $options;
00022 }
00023
00024 function query() {
00025 if (!empty($this->options['override'])) {
00026 $this->view->set_items_per_page(intval($this->options['items_per_page']));
00027 }
00028 }
00029
00030 function options_form(&$form, &$form_state) {
00031 $form['base_path'] = array(
00032 '#type' => 'textfield',
00033 '#title' => t('Base path'),
00034 '#default_value' => $this->options['base_path'],
00035 '#description' => t('Define the base path for links in this summary
00036 view, i.e. http://example.com/<strong>your_view_path/archive</strong>.
00037 Do not include beginning and ending forward slash. If this value
00038 is empty, views will use the first path found as the base path,
00039 in page displays, or / if no path could be found.'),
00040 );
00041 $form['count'] = array(
00042 '#type' => 'checkbox',
00043 '#default_value' => !empty($this->options['count']),
00044 '#title' => t('Display record count with link'),
00045 );
00046 $form['override'] = array(
00047 '#type' => 'checkbox',
00048 '#default_value' => !empty($this->options['override']),
00049 '#title' => t('Override number of items to display'),
00050 );
00051
00052 $form['items_per_page'] = array(
00053 '#type' => 'textfield',
00054 '#title' => t('Items to display'),
00055 '#default_value' => $this->options['items_per_page'],
00056 '#dependency' => array(
00057 'edit-options-summary-options-' . str_replace('_', '-', $this->definition['name']) . '-override' => array(1)
00058 ),
00059 );
00060 }
00061
00062 function render() {
00063 $rows = array();
00064 foreach ($this->view->result as $row) {
00065
00066 $rows[] = $row;
00067 }
00068
00069 return theme($this->theme_functions(), array(
00070 'view' => $this->view,
00071 'options' => $this->options,
00072 'rows' => $rows
00073 ));
00074 }
00075 }