You are here

views_raw_sql.module in Views Raw SQL 6

Same filename and directory in other branches
  1. 7 views_raw_sql.module

File

views_raw_sql.module
View source
<?php

/**
 * Implements hook_permission().
 */
function views_raw_sql_permission() {
  return array(
    'edit views raw sql' => array(
      'title' => t('Add or edit Views raw SQL fields and sorts'),
    ),
  );
}

/**
 * Implements hook_views_api().
 */
function views_raw_sql_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'views_raw_sql'),
  );
}

// views_raw_sql_views_api

/**
 * Implements hook_views_data().
 */
function views_raw_sql_views_data() {
  $data = array();
  $data['views_raw_sql'] = array(
    'table' => array(
      'group' => t('Raw SQL'),
      'join' => array(
        '#global' => array(),
      ),
    ),
  );
  $data['views_raw_sql']['raw_field'] = array(
    'title' => t('Raw field'),
    'help' => t('Provide raw SQL field expression.'),
    'field' => array(
      'handler' => 'views_handler_field_views_raw_sql',
    ),
  );
  $data['views_raw_sql']['raw_sort'] = array(
    'title' => t('Raw sort'),
    'help' => t('Provide raw SQL sort exporession.'),
    'sort' => array(
      'handler' => 'views_handler_sort_views_raw_sql',
    ),
  );
  return $data;
}

// views_raw_sql_views_data

/**
 * Implements hook_views_handlers().
 *
 **/
function views_raw_sql_views_handlers() {
  return array(
    'info' => array(),
    'handlers' => array(
      'views_handler_field_views_raw_sql' => array(
        'parent' => 'views_handler_field',
      ),
      'views_handler_sort_views_raw_sql' => array(
        'parent' => 'views_handler_sort',
      ),
    ),
  );
}

// views_raw_sql_views_handlers

Functions