function _calendar_systems_date_properties_schema_apply_change in Calendar Systems 7
Same name and namespace in other branches
- 8 calendar_systems_date_properties/calendar_systems_date_properties.module \_calendar_systems_date_properties_schema_apply_change()
- 7.2 calendar_systems_date_properties/calendar_systems_date_properties.module \_calendar_systems_date_properties_schema_apply_change()
2 calls to _calendar_systems_date_properties_schema_apply_change()
- calendar_systems_date_properties_settings_form_submit in calendar_systems_date_properties/
calendar_systems_date_properties.admin.inc - _state
- calendar_systems_date_properties_uninstall in calendar_systems_date_properties/
calendar_systems_date_properties.install - Implements hook_uninstall().
File
- calendar_systems_date_properties/
calendar_systems_date_properties.module, line 214 - Contains hook implementations and helpers.
Code
function _calendar_systems_date_properties_schema_apply_change($remove = FALSE) {
$entity_types = _calendar_systems_date_properties_entity_types();
foreach ($entity_types as $entity_type => $entity_type_info) {
if (isset($entity_type_info['integrated']) && $entity_type_info['integrated']) {
foreach ($entity_type_info['properties'] as $property_name => $property) {
$calendar_systems = _calendar_systems_date_properties_get_active_calendar_systems();
foreach ($calendar_systems as $calendar_system) {
foreach ($calendar_system['parts'] as $calendar_system_part_name => $calendar_system_part) {
$new_property_name = $property_name . '_' . $calendar_system['name'] . '_' . $calendar_system_part_name;
if (!$remove && $entity_type_info['integrated'] && isset($entity_type_info['selected_properties'][$property_name])) {
if (!db_field_exists($entity_type_info['base table'], $new_property_name)) {
db_add_field($entity_type_info['base table'], $new_property_name, array(
'type' => 'int',
'length' => 1,
'not null' => FALSE,
'default' => NULL,
));
}
}
else {
if (db_field_exists($entity_type_info['base table'], $new_property_name)) {
db_drop_field($entity_type_info['base table'], $new_property_name);
}
}
}
}
}
}
}
}