Skip to content

Instantly share code, notes, and snippets.

@rachellawson
Created August 30, 2012 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachellawson/3533696 to your computer and use it in GitHub Desktop.
Save rachellawson/3533696 to your computer and use it in GitHub Desktop.
.profile create taxonomy terms
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);
}
}
@rachellawson
Copy link
Author

goes into the .profile file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment