| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <p>Custom modules and add their own dates to the list the <a href="&topic:date_api/date-filter&">Date API Views filter</a> and <a href="&topic:date_api/date-argument&">Date API Views argument</a> can handle. See the following example for the way that core dates have been added:</p> 2 <pre> 3 /** 4 * Implementation of hook_date_api_fields(). 5 * on behalf of core fields. 6 * 7 * All modules that create custom fields that use the 8 * 'views_handler_field_date' handler can provide 9 * additional information here about the type of 10 * date they create so the date can be used by 11 * the Date API views date argument and date filter. 12 */ 13 function date_api_date_api_fields($field) { 14 $values = array( 15 // The type of date: DATE_UNIX, DATE_ISO, DATE_DATETIME. 16 'sql_type' => DATE_UNIX, 17 // Timezone handling options: 'none', 'site', 'date', 'utc'. 18 'tz_handling' => 'site', 19 // Needed only for dates that use 'date' tz_handling. 20 'timezone_field' => '', 21 // Needed only for dates that use 'date' tz_handling. 22 'offset_field' => '', 23 // Array of "table.field" values for related fields that should be 24 // loaded automatically in the Views SQL. 25 'related_fields' => array(), 26 // Granularity of this date field's db data. 27 'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'), 28 ); 29 30 switch ($field) { 31 case 'users.created': 32 case 'users.access': 33 case 'users.login': 34 case 'node.created': 35 case 'node.changed': 36 case 'node_revisions.timestamp': 37 case 'files.timestamp': 38 case 'node_counter.timestamp': 39 case 'accesslog.timestamp': 40 case 'comments.timestamp': 41 case 'node_comment_statistics.last_comment_timestamp': 42 return $values; 43 } 44 } 45 </pre>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |