Created
November 9, 2010 01:57
-
-
Save zhangtaihao/668604 to your computer and use it in GitHub Desktop.
Drupal: map content_taxonomy field vocabulary settings to core taxonomy node type configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$nodes = array(); | |
foreach (content_fields() as $field_key => $field) { | |
if (strpos($field['module'], 'content_taxonomy') === 0) { | |
$type = $field['type_name']; | |
$nodes[$field['vid']][$field_key] = $type; | |
} | |
} | |
module_load_include('inc', 'taxonomy', 'taxonomy.admin'); | |
foreach ($nodes as $vid => $types) { | |
$vocabulary = (array) taxonomy_vocabulary_load($vid); | |
foreach ($types as $type) { | |
$vocabulary['nodes'][$type] = $type; | |
} | |
taxonomy_save_vocabulary($vocabulary); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment