function date_columns in Date 5
Same name and namespace in other branches
- 5.2 date/date_admin.inc \date_columns()
- 6.2 date/date_admin.inc \date_columns()
- 6 date/date_admin.inc \date_columns()
Callback for field columns.
2 calls to date_columns()
- date_db_integrity in ./
date.install - _date_field_settings in ./
date_admin.inc - Implementation of hook_field_settings().
File
- ./
date_admin.inc, line 214
Code
function date_columns($field) {
if ($field['type'] == 'date') {
$db_columns['value'] = array(
'type' => 'varchar',
'length' => 20,
'not null' => FALSE,
'default' => NULL,
'sortable' => TRUE,
);
}
elseif ($field['type'] == 'datestamp') {
$db_columns['value'] = array(
'type' => 'integer',
'length' => 11,
'not null' => FALSE,
'default' => NULL,
'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' && ($field['type'] == 'date' || $field['type'] == 'datestamp')) {
$db_columns['timezone'] = array(
'type' => 'varchar',
'length' => 50,
'not null' => FALSE,
'default' => NULL,
'sortable' => TRUE,
);
$db_columns['offset'] = array(
'type' => 'integer',
'length' => 10,
'not null' => FALSE,
'default' => NULL,
'sortable' => TRUE,
);
}
return $db_columns;
}