On this page
function taxonomy_taxonomy_vocabulary_update
taxonomy_taxonomy_vocabulary_update($vocabulary)
Implements hook_taxonomy_vocabulary_update().
File
- modules/taxonomy/taxonomy.module, line 529
- Enables the organization of content into categories.
Code
function taxonomy_taxonomy_vocabulary_update($vocabulary) {
// Reflect machine name changes in the definitions of existing 'taxonomy'
// fields.
if (!empty($vocabulary->old_machine_name) && $vocabulary->old_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->old_machine_name) {
$value['vocabulary'] = $vocabulary->machine_name;
$update = TRUE;
}
}
if ($update) {
field_update_field($field);
}
}
}
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!taxonomy!taxonomy.module/function/taxonomy_taxonomy_vocabulary_update/7.x