1 views_plugin_style_summary_jump_menu.inc views_plugin_style_summary_jump_menu::render()

Render the display in this style.

Overrides views_plugin_style::render

File

core/modules/views/plugins/views_plugin_style_summary_jump_menu.inc, line 95
Contains the default summary style plugin, which displays items in an HTML list.

Class

views_plugin_style_summary_jump_menu
The default style plugin for summaries.

Code

function render() {
  $argument = $this->view->argument[$this->view->build_info['summary_level']];

  $url_options = array();

  if (!empty($this->view->exposed_raw_input)) {
    $url_options['query'] = $this->view->exposed_raw_input;
  }

  $options = array();
  $default_value = '';
  $row_args = array();
  foreach ($this->view->result as $id => $row) {
    $row_args[$id] = $argument->summary_argument($row);
  }
  $argument->process_summary_arguments($row_args);

  foreach ($this->view->result as $id => $row) {
    $args = $this->view->args;
    $args[$argument->position] = $row_args[$id];
    $base_path = NULL;
    if (!empty($argument->options['summary_options']['base_path'])) {
      $base_path = $argument->options['summary_options']['base_path'];
    }
    $path = url($this->view->get_url($args, $base_path), $url_options);
    $summary_value = strip_tags($argument->summary_name($row));
    $key = md5($path . $summary_value) . "::" . $path;

    $options[$key] = $summary_value;
    if (!empty($this->options['count'])) {
      $options[$key] .= ' (' . intval($row->{$argument->count_alias}) . ')';
    }
    if ($this->options['default_value'] && $_GET['q'] == $this->view->get_url($args)) {
      $default_value = $key;
    }
  }

  $settings = array(
    'hide' => $this->options['hide'],
    'button' => $this->options['text'],
    'title' => $this->options['label'],
    'choose' => $this->options['choose'],
    'inline' => $this->options['inline'],
    'default_value' => $default_value,
  );

  $form = backdrop_get_form('system_jump_menu', $options, $settings);
  return backdrop_render($form);
}