function date_columns in Date 5.2
Same name and namespace in other branches
- 5 date_admin.inc \date_columns()
- 6.2 date/date_admin.inc \date_columns()
- 6 date/date_admin.inc \date_columns()
Callback for field columns.
1 call to date_columns()
- _date_field_settings in date/
date_admin.inc - Implementation of hook_field_settings().
File
- date/
date_admin.inc, line 297 - Date administration code. Moved to separate file since there is a lot of code here that is not needed often.
Code
function date_columns($field) {
if ($field['type'] == 'date') {
$db_columns['value'] = array(
'type' => 'varchar',
'length' => 20,
'not null' => FALSE,
'sortable' => TRUE,
);
}
elseif ($field['type'] == 'datestamp') {
$db_columns['value'] = array(
'type' => 'integer',
'not null' => FALSE,
'sortable' => TRUE,
);
}
// If a second date is needed for 'To date', just make a copy of the first one.
if ($field['todate']) {
$db_columns['value2'] = $db_columns['value'];
}
// timezone and offset columns are used only if date-specific dates are chosen.
if ($field['tz_handling'] == 'date') {
$db_columns['timezone'] = array(
'type' => 'varchar',
'length' => 50,
'not null' => FALSE,
'sortable' => TRUE,
);
$db_columns['offset'] = array(
'type' => 'integer',
'not null' => FALSE,
'sortable' => TRUE,
);
if ($field['todate']) {
$db_columns['offset2'] = array(
'type' => 'integer',
'not null' => FALSE,
'sortable' => TRUE,
);
}
}
if ($field['repeat']) {
$db_columns['rrule'] = array(
'type' => 'text',
'not null' => FALSE,
'sortable' => FALSE,
);
}
return $db_columns;
}