Created
August 30, 2012 17:10
-
-
Save rachellawson/3533696 to your computer and use it in GitHub Desktop.
.profile create taxonomy terms
This file contains 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
function mundi_install_tasks($install_state) { | |
$tasks = array ( | |
'mundi_create_terms' => array( | |
'display_name' => st('Create taxonomy terms')) | |
); | |
return $tasks; | |
} | |
/** | |
* Implements hook_install_tasks() callback | |
*/ | |
function mundi_create_terms() { | |
/* no need to create a vocab already created by the pre-enabled feature | |
taxonomy_vocabulary_save((object) array( | |
'name' => 'Section', | |
'machine_name' => 'section' | |
));*/ | |
$terms = array(); | |
$vocabulary = taxonomy_vocabulary_machine_name_load('section'); | |
$terms[] = 'About us'; | |
$terms[] = 'Partnerships'; | |
$terms[] = 'Products'; | |
foreach ($terms as $name) { | |
$term = new stdClass(); | |
$term->vid = $vocabulary->vid; | |
$term->name = $name; | |
taxonomy_term_save($term); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
goes into the .profile file