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

Preprocess theme function to print a single record from a row, with fields

File

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

Code

function template_preprocess_views_view_summary(&$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;
  }

  $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) {
    $variables['row_classes'][$id] = '';

    $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';
    }
  }
}