You are here

function views_aggregator_replace in Views Aggregator Plus 7

Same name and namespace in other branches
  1. 8 views_aggregator_functions.inc \views_aggregator_replace()

Aggregates a field group as a word, phrase or number.

Parameters

array $groups: An array of groups of rows, each group indexed by group value.

object $field_handler: The handler for the view column.

string $replace_text: An optional parameter, specifying the replacement text to use.

string $column_label: An optional parameter, specifying a label placed the bottom of the column.

Return value

array An array of values, one for each group and one for the 'column'.

File

./views_aggregator_functions.inc, line 608
views_aggregator_functions.inc

Code

function views_aggregator_replace($groups, $field_handler, $replace_text = NULL, $column_label = NULL) {
  $values = array();
  foreach ($groups as $group => $rows) {
    if (isset($replace_text)) {
      $values[$group] = $replace_text;
    }
    if (count($rows) > 1 && isset($replace_text)) {

      // With more than one field in a group the fields no longer belong to one
      // particular entity. Cannot support hyper-linking, so switch it off.
      // Unfortunately this applies to the entire column.
      unset($field_handler->options['link_to_node']);
    }
  }
  if (isset($column_label)) {
    $values['column'] = $column_label;
  }
  return $values;
}