| 1 |
<?php
|
| 2 |
// $Id: ad_views.views-ad_image.inc,v 1.3 2009/09/10 12:06:14 milesgillham Exp $
|
| 3 |
/*
|
| 4 |
* @file
|
| 5 |
*
|
| 6 |
* This file provides ad_image module Views interface:
|
| 7 |
* Ad Image (ad_image)
|
| 8 |
* {ad_image}
|
| 9 |
* {ad_image_format}
|
| 10 |
*
|
| 11 |
*/
|
| 12 |
|
| 13 |
function get_ad_image_views_data() {
|
| 14 |
$data = array();
|
| 15 |
if (db_table_exists('ad_image')) {
|
| 16 |
// All ads are in a single table group
|
| 17 |
$data['ad_image']['table']['group'] = t('Ad Image');
|
| 18 |
// ad_image is a related table to ads
|
| 19 |
$data['ad_image']['table']['join']['ads'] = array(
|
| 20 |
'left_field' => 'aid',
|
| 21 |
'field' => 'aid'
|
| 22 |
);
|
| 23 |
|
| 24 |
// Ad image - 'fid' relationship
|
| 25 |
$data['ad_image']['fid'] = array(
|
| 26 |
'title' => t('Fid'),
|
| 27 |
// The help that appears on the UI
|
| 28 |
'help' => t('The {files}.fid File ID that this ad relates to.'),
|
| 29 |
// Table relationship
|
| 30 |
'relationship' => array(
|
| 31 |
'label' => t('Files'),
|
| 32 |
'base' => 'files',
|
| 33 |
'base field' => 'fid',
|
| 34 |
// This allows us to not show this relationship if the base is already
|
| 35 |
// files so files won't create circular relationships.
|
| 36 |
'skip base' => array('files')
|
| 37 |
)
|
| 38 |
);
|
| 39 |
// Ad image - 'url'
|
| 40 |
$data['ad_image']['url'] = array(
|
| 41 |
'title' => t('URL'),
|
| 42 |
// The help that appears on the UI
|
| 43 |
'help' => t('The ad URL.'),
|
| 44 |
// Information for displaying
|
| 45 |
'field' => array(
|
| 46 |
'handler' => 'views_handler_field_url',
|
| 47 |
'click sortable' => TRUE
|
| 48 |
),
|
| 49 |
// Information for accepting as an argument
|
| 50 |
'argument' => array(
|
| 51 |
'handler' => 'views_handler_argument_string',
|
| 52 |
'name field' => 'title',
|
| 53 |
'numeric' => FALSE,
|
| 54 |
),
|
| 55 |
// Information for accepting as a filter
|
| 56 |
'filter' => array(
|
| 57 |
'handler' => 'views_handler_filter_string'
|
| 58 |
),
|
| 59 |
// Information for sorting
|
| 60 |
'sort' => array(
|
| 61 |
'handler' => 'views_handler_sort'
|
| 62 |
)
|
| 63 |
);
|
| 64 |
// Ad image - 'tooltip'
|
| 65 |
$data['ad_image']['tooltip'] = array(
|
| 66 |
'title' => t('Tooltip'),
|
| 67 |
// The help that appears on the UI
|
| 68 |
'help' => t('The tooltip.'),
|
| 69 |
// Information for displaying
|
| 70 |
'field' => array(
|
| 71 |
'handler' => 'views_handler_field',
|
| 72 |
'click sortable' => TRUE
|
| 73 |
),
|
| 74 |
// Information for accepting as an argument
|
| 75 |
'argument' => array(
|
| 76 |
'handler' => 'views_handler_argument_string',
|
| 77 |
'name field' => 'title',
|
| 78 |
'numeric' => FALSE,
|
| 79 |
),
|
| 80 |
// Information for accepting as a filter
|
| 81 |
'filter' => array(
|
| 82 |
'handler' => 'views_handler_filter_string'
|
| 83 |
),
|
| 84 |
// Information for sorting
|
| 85 |
'sort' => array(
|
| 86 |
'handler' => 'views_handler_sort'
|
| 87 |
)
|
| 88 |
);
|
| 89 |
// Ad image - 'remote_image'
|
| 90 |
$data['ad_image']['remote_image'] = array(
|
| 91 |
'title' => t('Remote image'),
|
| 92 |
// The help that appears on the UI
|
| 93 |
'help' => t('The remote image URL.'),
|
| 94 |
// Information for displaying
|
| 95 |
'field' => array(
|
| 96 |
'handler' => 'views_handler_field_url',
|
| 97 |
'click sortable' => TRUE
|
| 98 |
),
|
| 99 |
// Information for accepting as an argument
|
| 100 |
'argument' => array(
|
| 101 |
'handler' => 'views_handler_argument_string',
|
| 102 |
'name field' => 'title',
|
| 103 |
'numeric' => FALSE,
|
| 104 |
),
|
| 105 |
// Information for accepting as a filter
|
| 106 |
'filter' => array(
|
| 107 |
'handler' => 'views_handler_filter_string'
|
| 108 |
),
|
| 109 |
// Information for sorting
|
| 110 |
'sort' => array(
|
| 111 |
'handler' => 'views_handler_sort'
|
| 112 |
)
|
| 113 |
);
|
| 114 |
// Ad image - 'width'
|
| 115 |
$data['ad_image']['width'] = array(
|
| 116 |
'title' => t('Width'),
|
| 117 |
// The help that appears on the UI
|
| 118 |
'help' => t('Ad width.'),
|
| 119 |
// Information for displaying
|
| 120 |
'field' => array(
|
| 121 |
'handler' => 'views_handler_field_numeric',
|
| 122 |
'click sortable' => TRUE
|
| 123 |
),
|
| 124 |
// Information for accepting as an argument
|
| 125 |
'argument' => array(
|
| 126 |
'handler' => 'views_handler_argument_numeric',
|
| 127 |
'name field' => 'title',
|
| 128 |
'numeric' => TRUE,
|
| 129 |
'validate type' => 'aid'
|
| 130 |
),
|
| 131 |
// Information for accepting as a filter
|
| 132 |
'filter' => array(
|
| 133 |
'handler' => 'views_handler_filter_numeric'
|
| 134 |
),
|
| 135 |
// Information for sorting
|
| 136 |
'sort' => array(
|
| 137 |
'handler' => 'views_handler_sort'
|
| 138 |
)
|
| 139 |
);
|
| 140 |
// Ad image - 'height'
|
| 141 |
$data['ad_image']['height'] = array(
|
| 142 |
'title' => t('Height'),
|
| 143 |
// The help that appears on the UI
|
| 144 |
'help' => t('Ad height.'),
|
| 145 |
// Information for displaying
|
| 146 |
'field' => array(
|
| 147 |
'handler' => 'views_handler_field_numeric',
|
| 148 |
'click sortable' => TRUE
|
| 149 |
),
|
| 150 |
// Information for accepting as an argument
|
| 151 |
'argument' => array(
|
| 152 |
'handler' => 'views_handler_argument_numeric',
|
| 153 |
'name field' => 'title',
|
| 154 |
'numeric' => TRUE,
|
| 155 |
'validate type' => 'aid'
|
| 156 |
),
|
| 157 |
// Information for accepting as a filter
|
| 158 |
'filter' => array(
|
| 159 |
'handler' => 'views_handler_filter_numeric'
|
| 160 |
),
|
| 161 |
// Information for sorting
|
| 162 |
'sort' => array(
|
| 163 |
'handler' => 'views_handler_sort'
|
| 164 |
)
|
| 165 |
);
|
| 166 |
}
|
| 167 |
|
| 168 |
if (db_table_exists('ad_image_format')) {
|
| 169 |
// All ads are in a single table group
|
| 170 |
$data['ad_image_format']['table']['group'] = t('Ad Image Format');
|
| 171 |
$data['ad_image_format']['table']['base'] = array(
|
| 172 |
'field' => 'gid',
|
| 173 |
'title' => t('Ad Image Format'),
|
| 174 |
'help' => t('Image module ad formats.')
|
| 175 |
);
|
| 176 |
|
| 177 |
// Ad image format gid - 'gid'
|
| 178 |
$data['ad_image_format']['gid'] = array(
|
| 179 |
'title' => t('Gid'),
|
| 180 |
// The help that appears on the UI
|
| 181 |
'help' => t('The Ad Image Format ID.'),
|
| 182 |
// Information for displaying
|
| 183 |
'field' => array(
|
| 184 |
'handler' => 'views_handler_field_numeric',
|
| 185 |
'click sortable' => TRUE
|
| 186 |
),
|
| 187 |
// Information for accepting as an argument
|
| 188 |
'argument' => array(
|
| 189 |
'handler' => 'views_handler_argument_numeric',
|
| 190 |
'name field' => 'title',
|
| 191 |
'numeric' => TRUE
|
| 192 |
),
|
| 193 |
// Information for accepting as a filter
|
| 194 |
'filter' => array(
|
| 195 |
'handler' => 'views_handler_filter_numeric'
|
| 196 |
),
|
| 197 |
// Information for sorting
|
| 198 |
'sort' => array(
|
| 199 |
'handler' => 'views_handler_sort'
|
| 200 |
)
|
| 201 |
);
|
| 202 |
// Ad image format - 'min_width'
|
| 203 |
$data['ad_image_format']['min_width'] = array(
|
| 204 |
'title' => t('Min width'),
|
| 205 |
// The help that appears on the UI
|
| 206 |
'help' => t('Ad minimum width.'),
|
| 207 |
// Information for displaying
|
| 208 |
'field' => array(
|
| 209 |
'handler' => 'views_handler_field_numeric',
|
| 210 |
'click sortable' => TRUE
|
| 211 |
),
|
| 212 |
// Information for accepting as an argument
|
| 213 |
'argument' => array(
|
| 214 |
'handler' => 'views_handler_argument_numeric',
|
| 215 |
'name field' => 'title',
|
| 216 |
'numeric' => TRUE
|
| 217 |
),
|
| 218 |
// Information for accepting as a filter
|
| 219 |
'filter' => array(
|
| 220 |
'handler' => 'views_handler_filter_numeric'
|
| 221 |
),
|
| 222 |
// Information for sorting
|
| 223 |
'sort' => array(
|
| 224 |
'handler' => 'views_handler_sort'
|
| 225 |
)
|
| 226 |
);
|
| 227 |
// Ad image format - 'min_height'
|
| 228 |
$data['ad_image_format']['min_height'] = array(
|
| 229 |
'title' => t('Minimum height'),
|
| 230 |
// The help that appears on the UI
|
| 231 |
'help' => t('Ad minimum height.'),
|
| 232 |
// Information for displaying
|
| 233 |
'field' => array(
|
| 234 |
'handler' => 'views_handler_field_numeric',
|
| 235 |
'click sortable' => TRUE
|
| 236 |
),
|
| 237 |
// Information for accepting as an argument
|
| 238 |
'argument' => array(
|
| 239 |
'handler' => 'views_handler_argument_numeric',
|
| 240 |
'name field' => 'title',
|
| 241 |
'numeric' => TRUE
|
| 242 |
),
|
| 243 |
// Information for accepting as a filter
|
| 244 |
'filter' => array(
|
| 245 |
'handler' => 'views_handler_filter_numeric'
|
| 246 |
),
|
| 247 |
// Information for sorting
|
| 248 |
'sort' => array(
|
| 249 |
'handler' => 'views_handler_sort'
|
| 250 |
)
|
| 251 |
);
|
| 252 |
// Ad image format - 'max_width'
|
| 253 |
$data['ad_image_format']['max_width'] = array(
|
| 254 |
'title' => t('Max width'),
|
| 255 |
// The help that appears on the UI
|
| 256 |
'help' => t('Ad maximum width.'),
|
| 257 |
// Information for displaying
|
| 258 |
'field' => array(
|
| 259 |
'handler' => 'views_handler_field_numeric',
|
| 260 |
'click sortable' => TRUE
|
| 261 |
),
|
| 262 |
// Information for accepting as an argument
|
| 263 |
'argument' => array(
|
| 264 |
'handler' => 'views_handler_argument_numeric',
|
| 265 |
'name field' => 'title',
|
| 266 |
'numeric' => TRUE
|
| 267 |
),
|
| 268 |
// Information for accepting as a filter
|
| 269 |
'filter' => array(
|
| 270 |
'handler' => 'views_handler_filter_numeric'
|
| 271 |
),
|
| 272 |
// Information for sorting
|
| 273 |
'sort' => array(
|
| 274 |
'handler' => 'views_handler_sort'
|
| 275 |
)
|
| 276 |
);
|
| 277 |
// Ad image format - 'max_height'
|
| 278 |
$data['ad_image_format']['max_height'] = array(
|
| 279 |
'title' => t('Maximum height'),
|
| 280 |
// The help that appears on the UI
|
| 281 |
'help' => t('Ad maximum height.'),
|
| 282 |
// Information for displaying
|
| 283 |
'field' => array(
|
| 284 |
'handler' => 'views_handler_field_numeric',
|
| 285 |
'click sortable' => TRUE
|
| 286 |
),
|
| 287 |
// Information for accepting as an argument
|
| 288 |
'argument' => array(
|
| 289 |
'handler' => 'views_handler_argument_numeric',
|
| 290 |
'name field' => 'title',
|
| 291 |
'numeric' => TRUE
|
| 292 |
),
|
| 293 |
// Information for accepting as a filter
|
| 294 |
'filter' => array(
|
| 295 |
'handler' => 'views_handler_filter_numeric'
|
| 296 |
),
|
| 297 |
// Information for sorting
|
| 298 |
'sort' => array(
|
| 299 |
'handler' => 'views_handler_sort'
|
| 300 |
)
|
| 301 |
);
|
| 302 |
// Ad image format - 'max_size'
|
| 303 |
$data['ad_image_format']['max_size'] = array(
|
| 304 |
'title' => t('Maximum size'),
|
| 305 |
// The help that appears on the UI
|
| 306 |
'help' => t('Ad maximum size.'),
|
| 307 |
// Information for displaying
|
| 308 |
'field' => array(
|
| 309 |
'handler' => 'views_handler_field_numeric',
|
| 310 |
'click sortable' => TRUE
|
| 311 |
),
|
| 312 |
// Information for accepting as an argument
|
| 313 |
'argument' => array(
|
| 314 |
'handler' => 'views_handler_argument_numeric',
|
| 315 |
'name field' => 'title',
|
| 316 |
'numeric' => TRUE
|
| 317 |
),
|
| 318 |
// Information for accepting as a filter
|
| 319 |
'filter' => array(
|
| 320 |
'handler' => 'views_handler_filter_numeric'
|
| 321 |
),
|
| 322 |
// Information for sorting
|
| 323 |
'sort' => array(
|
| 324 |
'handler' => 'views_handler_sort'
|
| 325 |
)
|
| 326 |
);
|
| 327 |
}
|
| 328 |
return $data;
|
| 329 |
}
|
| 330 |
|