taxonomy_update_7002

Versions
7
taxonomy_update_7002()

Add vocabulary machine_name column.

Code

modules/taxonomy/taxonomy.install, line 219

<?php
function taxonomy_update_7002() {
  $field = array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
    'description' => 'The vocabulary machine name.',
  );

  db_add_field('taxonomy_vocabulary', 'machine_name', $field);

  foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
    $machine_name = 'vocabulary_' . $vid;
    db_update('taxonomy_vocabulary')
      ->fields(array('machine_name' => 'vocabulary_' . $vid))
      ->condition('vid', $vid)
      ->execute();
    field_attach_create_bundle('taxonomy_term', $machine_name);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.