function date_update_7000 in Date 7.3
Same name and namespace in other branches
- 7.2 date.install \date_update_7000()
Get rid of the individual formatters for each format type.
These are now settings in the default formatter.
File
- ./
date.install, line 123 - Install, update and uninstall functions for the Date module.
Code
function date_update_7000() {
$instances = field_info_instances();
foreach ($instances as $entity_type => $entities) {
foreach ($entities as $bundle => $fields) {
foreach ($fields as $field_name => $instance) {
if (in_array($instance['widget']['type'], array(
'date_popup',
))) {
$changed = FALSE;
foreach ($instance['display'] as $context => $display) {
if ($display['type'] != 'date_default' && $display['type'] != 'date_interval' && $display['type'] != 'hidden') {
$instance['display'][$context]['type'] = 'date_default';
$instance['display'][$context]['settings']['format_type'] = str_replace('date_', '', $display['type']);
$changed = TRUE;
}
}
if ($changed) {
field_update_instance($instance);
}
}
}
}
}
}