function uc_catalog_update_7003 in Ubercart 7.3
Renames Catalog taxonomy reference field created in taxonomy_update_7004().
File
- uc_catalog/
uc_catalog.install, line 198 - Install, update and uninstall functions for the uc_catalog module.
Code
function uc_catalog_update_7003() {
$vid = variable_get('uc_catalog_vid', 0);
$field_name = 'taxonomy_vocabulary_' . $vid;
if ($field = field_info_field($field_name)) {
$field['field_name'] = 'taxonomy_catalog';
unset($field['id']);
field_create_field($field);
foreach ($field['bundles'] as $type) {
$instance = array(
'field_name' => 'taxonomy_catalog',
'entity_type' => 'node',
'bundle' => $type,
'label' => t('Catalog'),
'settings' => array(
'allowed_values' => array(
array(
'vid' => $vid,
'parent' => '0',
),
),
),
);
field_create_instance($instance);
}
if (isset($field['id'])) {
field_delete_field($field_name);
}
}
}