You are here

public function Table::getCell in Views Aggregator Plus 8

Returns the raw or rendered result at the intersection of column and row.

Parameters

object $field_handler: The handler associated with the result column being requested.

int $row_num: The result row number.

bool $render: Whether the rendered or raw value should be returned.

Return value

string Returns empty string if there are no results for the requested row_num.

1 call to Table::getCell()
Table::setAggregatedGroupValues in src/Plugin/views/style/Table.php
Write the aggregated results back into the View's rendered results.

File

src/Plugin/views/style/Table.php, line 594

Class

Table
Style plugin to render each item as a row in a table.

Namespace

Drupal\views_aggregator\Plugin\views\style

Code

public function getCell($field_handler, $row_num, $render = FALSE) {

  // Some functions need rendered values (e.g. enumerate).
  // For the rendered_fields array we need id, otherwise take entity_field.
  if (isset($field_handler->options['entity_field']) && $render == FALSE) {
    $field_name = $field_handler->options['entity_field'];
  }
  else {
    $field_name = $field_handler->options['id'];
  }
  if (isset($this->rendered_fields[$row_num][$field_name])) {

    // Special handling of rendered fields, "Global: Custom text",
    // "Global: View" and custom plugin fields.
    if ($render === TRUE || $this
      ->isCustomTextField($field_handler) || $this
      ->isViewsFieldView($field_handler) || !in_array($field_handler
      ->getProvider(), [
      'views',
      'webform_views',
    ])) {
      return trim(strip_tags((string) $this->rendered_fields[$row_num][$field_name]));
    }

    // Special handling of "Webform submission data".
    if ($this
      ->isWebformNumeric($field_handler) || $this
      ->isWebformField($field_handler)) {
      $webform_raw_value = $this
        ->getCellRaw($field_handler, $field_handler->view->result[$row_num], TRUE);
      return $webform_raw_value;
    }
  }
  if (!isset($field_handler->view->result[$row_num])) {
    return '';
  }
  $field_handler->view->row_index = $row_num;
  return $this
    ->getCellRaw($field_handler, $field_handler->view->result[$row_num], TRUE);
}