function _taxonomy_xml_get_vocabulary_placeholder in Taxonomy import/export via XML 6
Same name and namespace in other branches
- 5.2 taxonomy_xml.module \_taxonomy_xml_get_vocabulary_placeholder()
- 5 taxonomy_xml.module \_taxonomy_xml_get_vocabulary_placeholder()
- 6.2 taxonomy_xml.module \_taxonomy_xml_get_vocabulary_placeholder()
- 7 taxonomy_xml.process.inc \_taxonomy_xml_get_vocabulary_placeholder()
Either fetch the named vocab if it exists, or create and return a useful placeholder.
Return value
the new vocab object.
5 calls to _taxonomy_xml_get_vocabulary_placeholder()
- taxonomy_xml_absorb_vocabulary_definitions in ./
taxonomy_xml.module - Use the vocabs defined as resources in the input to find or create vocabulary definitions.
- taxonomy_xml_invoke_import in ./
taxonomy_xml.module - Do the actual importing from the given string, pased on the parameters passed from the form.
- taxonomy_xml_mesh_parse in ./
mesh_format.inc - Reads a XML file and creates the term definitions found in it.
- taxonomy_xml_tcs_parse in ./
tcs_format.inc - Reads a TCS file and creates the term definitions found in it.
- taxonomy_xml_xml_parse in ./
xml_format.inc - Initiate the parser on the custom XML schema.
File
- ./
taxonomy_xml.module, line 553 - taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.
Code
function _taxonomy_xml_get_vocabulary_placeholder($name) {
if ($vocabulary = taxonomy_xml_get_vocabulary_by_name($name)) {
return $vocabulary;
}
// Create new vocab
$vocabulary = array(
'name' => $name,
'relations' => TRUE,
'hierarchy' => 2,
);
module_invoke('taxonomy', 'save_vocabulary', $vocabulary);
// Need to retrieve it from DB again - the result isn't given back to us.
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE LOWER('%s') LIKE LOWER(name)", $vocabulary['name']));
$vocabulary = taxonomy_vocabulary_load($vid);
drupal_set_message(t('Created vocabulary %vid %vocabname to put these terms into. You probably want to <a href="!vocablink">go edit it now</a>.', array(
'%vocabname' => $vocabulary->name,
'%vid' => $vid,
'!vocablink' => url('admin/content/taxonomy/edit/vocabulary/' . $vid),
)));
return $vocabulary;
}