You are here

function getlocations_fields_views_data in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_fields/views/getlocations_fields.views.inc \getlocations_fields_views_data()

Implements hook_views_data().

File

modules/getlocations_fields/views/getlocations_fields.views.inc, line 15
getlocations_fields.views.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_fields_views_data() {

  // ----------------------------------------------------------------
  // getlocations_fields table -- basic table information.
  // Define the base group of this table. Fields that don't
  // have a group defined will go into this field by default.
  $data['getlocations_fields']['table']['group'] = t('Getlocations Fields');

  // Advertise this table as a possible base table
  $data['getlocations_fields']['table']['base'] = array(
    'field' => 'glid',
    'title' => t('Getlocations'),
    'help' => t('Locations are addresses and map coordinates.'),
    'weight' => -10,
  );

  // ----------------------------------------------------------------
  // getlocations_fields table -- fields
  // glid
  $data['getlocations_fields']['glid'] = array(
    'title' => t('Glid'),
    'help' => t('The getlocations ID of the location.'),
    // The help that appears on the UI,
    // Information for displaying the glid
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    // Information for accepting a glid as an argument. Also supports 1+2+3 for OR or 1,2,3 for AND
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_glid',
    ),
    // Information for accepting a glid as a filter
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
      'allow empty' => TRUE,
    ),
    // Information for sorting on a glid.
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // name
  $data['getlocations_fields']['name'] = array(
    'title' => t('Name'),
    'help' => t('The name of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // street
  $data['getlocations_fields']['street'] = array(
    'title' => t('Street'),
    'help' => t('The street address of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // additional
  $data['getlocations_fields']['additional'] = array(
    'title' => t('Additional'),
    'help' => t('The additional address of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // city
  $data['getlocations_fields']['city'] = array(
    'title' => t('City'),
    'help' => t('The city of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_city',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // province
  $data['getlocations_fields']['province'] = array(
    'title' => t('Province'),
    'help' => t('The province of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_province',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // postal_code
  $data['getlocations_fields']['postal_code'] = array(
    'title' => t('Postal Code'),
    'help' => t('The postal code of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_postcode',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // country
  $data['getlocations_fields']['country'] = array(
    'title' => t('Country'),
    'help' => t('The country of the selected location.'),
    'field' => array(
      'handler' => 'getlocations_fields_handler_field_country',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_country',
    ),
    'filter' => array(
      'handler' => 'getlocations_fields_handler_filter_country',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // latitude
  $data['getlocations_fields']['latitude'] = array(
    'title' => t('Latitude'),
    'help' => t('The latitude of the selected location.'),
    'field' => array(
      'handler' => 'getlocations_fields_handler_field_latitude',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // longitude
  $data['getlocations_fields']['longitude'] = array(
    'title' => t('Longitude'),
    'help' => t('The longitude of the selected location.'),
    'field' => array(
      'handler' => 'getlocations_fields_handler_field_longitude',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // marker
  $data['getlocations_fields']['marker'] = array(
    'title' => t('Marker'),
    'help' => t('The marker of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // field_name
  $data['getlocations_fields']['field_name'] = array(
    'title' => t('Field name'),
    'help' => t('The Field name of the selected location.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // coordinates
  $data['getlocations_fields']['coordinates'] = array(
    'title' => t('Coordinates'),
    'help' => t("The coordinates of the selected location in 'lat,long' format."),
    'field' => array(
      'field' => 'latitude',
      // The handler adds the longitude.
      'handler' => 'getlocations_fields_handler_field_coordinates',
      'click sortable' => FALSE,
    ),
  );

  // wkt
  $data['getlocations_fields']['wkt'] = array(
    'title' => t('Wkt'),
    'help' => t("The coordinates of the selected location in WKT format."),
    'field' => array(
      'field' => 'latitude',
      // The handler adds the longitude.
      'handler' => 'getlocations_fields_handler_field_wkt',
      'click sortable' => FALSE,
    ),
  );

  // bbox
  $data['getlocations_fields']['bbox'] = array(
    'title' => t('Bounding box'),
    'help' => t('Filter locations within a bounding box.'),
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_bbox',
    ),
  );

  // distance
  $data['getlocations_fields']['distance'] = array(
    'title' => t('Distance'),
    'help' => t("The distance from the selected location and either the current user or a specific location."),
    'field' => array(
      'handler' => 'getlocations_fields_handler_field_distance',
    ),
    'sort' => array(
      'handler' => 'getlocations_fields_handler_sort_distance',
    ),
    'argument' => array(
      'handler' => 'getlocations_fields_handler_argument_distance',
    ),
    'filter' => array(
      'handler' => 'getlocations_fields_handler_filter_distance',
    ),
  );

  // data
  $data['getlocations_fields']['data'] = array(
    'title' => t('Data'),
    'help' => t('Serialized data of the selected location.'),
    'field' => array(
      'handler' => 'getlocations_fields_handler_field_data',
    ),
  );

  /*
   // address
   $data['getlocations_fields']['address'] = array(
     'title' => t('Address'),
     'help' => t('The entire address block for the location.'),
     'field' => array(
       'field' => 'glid',
  #      'handler' => 'getlocations_fields_handler_field_address',
       'element type' => 'div',
     ),
   );
  */

  // ----------------------------------------------------------------
  // END getlocations_fields table -- fields
  return $data;
}