New module 'Date'
This commit is contained in:
parent
a4887c6502
commit
ac4b84765b
116 changed files with 30150 additions and 0 deletions
45
sites/all/modules/date/help/date-views-dates.html
Normal file
45
sites/all/modules/date/help/date-views-dates.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<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>
|
||||
<pre>
|
||||
/**
|
||||
* Implementation of hook_date_api_fields().
|
||||
* on behalf of core fields.
|
||||
*
|
||||
* All modules that create custom fields that use the
|
||||
* 'views_handler_field_date' handler can provide
|
||||
* additional information here about the type of
|
||||
* date they create so the date can be used by
|
||||
* the Date API views date argument and date filter.
|
||||
*/
|
||||
function date_api_date_api_fields($field) {
|
||||
$values = array(
|
||||
// The type of date: DATE_UNIX, DATE_ISO, DATE_DATETIME.
|
||||
'sql_type' => DATE_UNIX,
|
||||
// Timezone handling options: 'none', 'site', 'date', 'utc'.
|
||||
'tz_handling' => 'site',
|
||||
// Needed only for dates that use 'date' tz_handling.
|
||||
'timezone_field' => '',
|
||||
// Needed only for dates that use 'date' tz_handling.
|
||||
'offset_field' => '',
|
||||
// Array of "table.field" values for related fields that should be
|
||||
// loaded automatically in the Views SQL.
|
||||
'related_fields' => array(),
|
||||
// Granularity of this date field's db data.
|
||||
'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'),
|
||||
);
|
||||
|
||||
switch ($field) {
|
||||
case 'users.created':
|
||||
case 'users.access':
|
||||
case 'users.login':
|
||||
case 'node.created':
|
||||
case 'node.changed':
|
||||
case 'node_revisions.timestamp':
|
||||
case 'files.timestamp':
|
||||
case 'node_counter.timestamp':
|
||||
case 'accesslog.timestamp':
|
||||
case 'comments.timestamp':
|
||||
case 'node_comment_statistics.last_comment_timestamp':
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
</pre>
|
Reference in a new issue