1 taxonomy.module | taxonomy_taxonomy_vocabulary_update(TaxonomyVocabulary $vocabulary) |
Implements hook_taxonomy_vocabulary_update().
File
- core/
modules/ taxonomy/ taxonomy.module, line 635 - Enables the organization of content into categories.
Code
function taxonomy_taxonomy_vocabulary_update(TaxonomyVocabulary $vocabulary) {
// Reflect machine name changes in the definitions of existing 'taxonomy'
// fields.
if (!empty($vocabulary->original->machine_name) && $vocabulary->original->machine_name != $vocabulary->machine_name) {
$fields = field_read_fields();
foreach ($fields as $field_name => $field) {
$update = FALSE;
if ($field['type'] == 'taxonomy_term_reference') {
foreach ($field['settings']['allowed_values'] as $key => &$value) {
if ($value['vocabulary'] == $vocabulary->original->machine_name) {
$value['vocabulary'] = $vocabulary->machine_name;
$update = TRUE;
}
}
if ($update) {
field_update_field($field);
}
}
}
}
}