1 views.theme.inc template_preprocess_views_view_summary_unformatted(&$variables)

Template preprocess theme function to print summary basically unformatted.

File

core/modules/views/templates/views.theme.inc, line 395
Preprocessors and helper functions to make theme development easier.

Code

function template_preprocess_views_view_summary_unformatted(&$variables) {
  $view = $variables['view'];
  $argument = $view->argument[$view->build_info['summary_level']];
  $variables['row_classes'] = array();

  $url_options = array();

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

  $count = 0;
  $active_urls = backdrop_map_assoc(array(
    url($_GET['q'], array('alias' => TRUE)), // force system path
    url($_GET['q']), // could be an alias
  ));

  // Collect all arguments foreach row, to be able to alter them for example by the validator.
  // This is not done per single argument value, because this could cause performance problems.
  $row_args = array();
  foreach ($variables['rows'] as $id => $row) {
    $row_args[$id] = $argument->summary_argument($row);
  }
  $argument->process_summary_arguments($row_args);

  foreach ($variables['rows'] as $id => $row) {
    // only false on first time:
    if ($count++) {
      $variables['rows'][$id]->separator = filter_xss_admin($variables['options']['separator']);
    }
    $variables['rows'][$id]->link = $argument->summary_name($row);
    $args = $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'];
    }
    $variables['rows'][$id]->url = url($view->get_url($args, $base_path), $url_options);
    $variables['rows'][$id]->count = intval($row->{$argument->count_alias});
    if (isset($active_urls[$variables['rows'][$id]->url])) {
      $variables['row_classes'][$id] = 'active';
    }
  }
}