views_natural_sort.views.inc 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?php
/**
 * @file
 * Views related hooks.
 *
 * Automatically included by views. Because of the nature of this module this
 * is most of the code.
 */

/**
 * Implementation of hook_views_data().
 */
function views_natural_sort_views_data() {

  $data['views_natural_sort']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
      // We only support sorting on title so go ahead and build filter it into the join.
      'extra' => array(
        array(
          'field' => 'field',
          'value' => 'title',
          'operator' => '=',
        )
      )
    ),
  );

  $data['views_natural_sort']['content'] = array(
    'title' => 'Title - Natural',
    'group' => t('Node'),
33 34 35 36 37 38 39 40 41
    'help' => t('The title of a node filtered for natural sorting.'),
    // Normally you wouldn't want a field or argument on this but its available for grouping.
    'field' => array(
      'handler' => 'views_handler_field_node',
      'click sortable' => TRUE,
     ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
42 43 44 45 46 47 48
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  return $data;
}