You are here

function views_calc_views_data in Views Calc 6

Same name and namespace in other branches
  1. 6.3 views_calc.views.inc \views_calc_views_data()
  2. 7 views_calc.views.inc \views_calc_views_data()

Implementation of hook_views_data().

Add calc fields to views field list.

File

./views_calc.views.inc, line 26

Code

function views_calc_views_data() {
  $data = array();
  $results = _views_calc_fields();
  while ($field = db_fetch_array($results)) {
    $data[$field['base']]['cid' . $field['cid']] = array(
      'group' => t('Views Calc'),
      'title' => t($field['label']),
      'help' => $field['calc'],
      'field' => array(
        'field' => 'cid' . $field['cid'],
        'table' => 'node',
        'handler' => 'views_calc_field_handler',
        'click sortable' => TRUE,
        'allow empty' => TRUE,
        'cid' => $field['cid'],
        'format' => $field['format'],
        'custom' => $field['custom'],
        'calc' => $field['calc'],
      ),
      'sort' => array(
        'handler' => 'views_calc_handler_sort',
      ),
    );
  }
  return $data;
}