You are here

function views_calc_table::get_calc_fields in Views Calc 6

Same name and namespace in other branches
  1. 6.3 views_calc_table.inc \views_calc_table::get_calc_fields()
  2. 7 views_calc_table.inc \views_calc_table::get_calc_fields()

Get views_calc fields

1 call to views_calc_table::get_calc_fields()
views_calc_table::pre_render in ./views_calc_table.inc
Views Method pre_render().

File

./views_calc_table.inc, line 246
Copied from the table style plugin.

Class

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

Code

function get_calc_fields() {

  // TODO on preview this returns the wrong list.
  $options = $this->view->style_plugin->options;
  $handler = $this->view->style_plugin;
  $fields = $this->view->field;
  $columns = $handler
    ->sanitize_columns($options['columns'], $fields);
  $calcs = array_keys(_views_calc_calc_options());
  $calc_fields = array();
  foreach ($columns as $field => $column) {
    if ($field == $column && empty($fields[$field]->options['exclude'])) {
      if ($options['info'][$field]['has_calc']) {
        foreach ($calcs as $calc) {
          if (isset($this->options['info'][$field]['calc'][$calc])) {
            $calc_fields[$calc][] = $field;
          }
        }
      }
    }
  }
  return $calc_fields;
}