| 1 |
<?php
|
| 2 |
// $Id: weblinks.views.inc,v 1.1.2.5 2009/02/14 23:35:14 nancyw Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Provide views data and handlers for weblinks.module
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* @defgroup views_weblinks_module weblinks.module handlers
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_views_data()
|
| 14 |
*/
|
| 15 |
function weblinks_views_data() {
|
| 16 |
// Basic table information.
|
| 17 |
// ----------------------------------------------------------------
|
| 18 |
// weblinks table
|
| 19 |
$data['weblinks']['table']['group'] = t('Web Links');
|
| 20 |
$data['weblinks']['table']['join'] = array(
|
| 21 |
// ...to the node table
|
| 22 |
'node' => array(
|
| 23 |
'left_field' => 'nid',
|
| 24 |
'field' => 'nid AND node.vid = weblinks.vid',
|
| 25 |
),
|
| 26 |
);
|
| 27 |
|
| 28 |
// url
|
| 29 |
$data['weblinks']['url'] = array(
|
| 30 |
'title' => t('URL'),
|
| 31 |
'help' => t('The web address for the link.'),
|
| 32 |
|
| 33 |
'field' => array(
|
| 34 |
'handler' => 'views_handler_field_weblinks',
|
| 35 |
'click sortable' => TRUE,
|
| 36 |
),
|
| 37 |
'sort' => array(
|
| 38 |
'handler' => 'views_handler_sort',
|
| 39 |
),
|
| 40 |
);
|
| 41 |
|
| 42 |
// click_count
|
| 43 |
$data['weblinks']['click_count'] = array(
|
| 44 |
'title' => t('Click count'),
|
| 45 |
'help' => t('The total number of times the link has been clicked.'),
|
| 46 |
|
| 47 |
'field' => array(
|
| 48 |
'handler' => 'views_handler_field_numeric',
|
| 49 |
'click sortable' => TRUE,
|
| 50 |
),
|
| 51 |
'filter' => array(
|
| 52 |
'handler' => 'views_handler_filter_numeric',
|
| 53 |
),
|
| 54 |
'sort' => array(
|
| 55 |
'handler' => 'views_handler_sort',
|
| 56 |
),
|
| 57 |
);
|
| 58 |
|
| 59 |
// last_click
|
| 60 |
$data['weblinks']['last_click'] = array(
|
| 61 |
'title' => t('Last click'),
|
| 62 |
'help' => t('The most recent time the link was clicked.'),
|
| 63 |
|
| 64 |
'field' => array(
|
| 65 |
'handler' => 'views_handler_field_date',
|
| 66 |
'click sortable' => TRUE,
|
| 67 |
),
|
| 68 |
'sort' => array(
|
| 69 |
'handler' => 'views_handler_sort',
|
| 70 |
),
|
| 71 |
);
|
| 72 |
|
| 73 |
// weight
|
| 74 |
$data['weblinks']['weight'] = array(
|
| 75 |
'title' => t('Weight'),
|
| 76 |
'help' => t("The node weight for the link's node."),
|
| 77 |
|
| 78 |
'field' => array(
|
| 79 |
'handler' => 'views_handler_field_numeric',
|
| 80 |
'click sortable' => TRUE,
|
| 81 |
),
|
| 82 |
'filter' => array(
|
| 83 |
'handler' => 'views_handler_filter_numeric',
|
| 84 |
),
|
| 85 |
'sort' => array(
|
| 86 |
'handler' => 'views_handler_sort',
|
| 87 |
),
|
| 88 |
);
|
| 89 |
|
| 90 |
// last_status
|
| 91 |
$data['weblinks']['last_status'] = array(
|
| 92 |
'title' => t('Last status'),
|
| 93 |
'help' => t('The status returned the last time the link was checked for validity.'),
|
| 94 |
|
| 95 |
'field' => array(
|
| 96 |
// 'handler' => 'views_handler_field_string',
|
| 97 |
'click sortable' => TRUE,
|
| 98 |
),
|
| 99 |
'filter' => array(
|
| 100 |
'handler' => 'views_handler_filter_string',
|
| 101 |
),
|
| 102 |
'sort' => array(
|
| 103 |
'handler' => 'views_handler_sort',
|
| 104 |
),
|
| 105 |
);
|
| 106 |
|
| 107 |
// last_checked
|
| 108 |
$data['weblinks']['last_checked'] = array(
|
| 109 |
'title' => t('Last checked'),
|
| 110 |
'help' => t('The most recent time the link was checked to see if it works.'),
|
| 111 |
|
| 112 |
'field' => array(
|
| 113 |
'handler' => 'views_handler_field_date',
|
| 114 |
'click sortable' => TRUE,
|
| 115 |
),
|
| 116 |
'sort' => array(
|
| 117 |
'handler' => 'views_handler_sort',
|
| 118 |
),
|
| 119 |
);
|
| 120 |
|
| 121 |
return $data;
|
| 122 |
}
|