You are here

views_calc.views.inc in Views Calc 6

Same filename and directory in other branches
  1. 6.3 views_calc.views.inc
  2. 7 views_calc.views.inc

File

views_calc.views.inc
View source
<?php

/**
 * Implementation of hook_views_handlers().
 */
function views_calc_views_handlers() {
  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'views_calc'),
    ),
    'handlers' => array(
      'views_calc_field_handler' => array(
        'parent' => 'views_handler_field',
      ),
      'views_calc_handler_sort' => array(
        'parent' => 'views_handler_sort',
      ),
    ),
  );
}

/**
 * Implementation of hook_views_data().
 *
 * Add calc fields to views field list.
 */
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;
}

/**
 * Implementation of hook_views_plugins
 */
function views_calc_views_plugins() {
  $path = drupal_get_path('module', 'views_calc');
  $views_path = drupal_get_path('module', 'views');
  require_once "./{$path}/theme.inc";
  $data = array(
    'module' => 'views_calc',
    // This just tells our themes are elsewhere.
    'style' => array(
      // Style plugin for the navigation.
      'views_calc' => array(
        'title' => t('Views Calc Table'),
        'help' => t('Creates a table with column calculations.'),
        'handler' => 'views_calc_table',
        'path' => $path,
        'parent' => 'table',
        'theme' => 'views_calc_table',
        'theme file' => 'theme.inc',
        'theme path' => "{$path}",
        'uses row plugin' => FALSE,
        'uses fields' => TRUE,
        'uses options' => TRUE,
        'type' => 'normal',
        'even empty' => FALSE,
      ),
    ),
  );
  return $data;
}

Functions

Namesort descending Description
views_calc_views_data Implementation of hook_views_data().
views_calc_views_handlers Implementation of hook_views_handlers().
views_calc_views_plugins Implementation of hook_views_plugins