function _taxonomy_vocabulary_resource_create in Services 6.3
Same name and namespace in other branches
- 7.3 resources/taxonomy_resource.inc \_taxonomy_vocabulary_resource_create()
Create a new taxonomy vocabulary based on submitted values.
Here is a sample vocabulary array, taken from http://drupaldeveloper.in/article/programmatically-create-vocabulary
$vocabulary = array(
'name' => t("Name"). // Human readable name of the vocabulary
'description' => t("Description"), // extended description of the vocabulary
'help' => t("help"), // help text
'tags' => 0, // 1 to make this vocabulary free tagging
'multiple' => 0, // 1 to allow multiple selection
'required' => 0, // 1 to make the terms mandatory to be selected
'hierarchy' => 0, // 1 to allow and create hierarchy of the terms within the vocabulary
'relations' => 0, // 1 to set and allow relation amongst multiple terms
'module' => 'mymodule', // provide the module name in which the vocabulary is defined and which is calling this function
'node' => array('story' => 1), // content types to which this vocabulary will be attached to
'weight' => -9, // set the weight to display the vocabulary in the list
);
Parameters
$vocabulary: Array of values for the taxonomy vocabulary.
Return value
Status constant indicating if vocabulary was inserted or updated.
See also
1 call to _taxonomy_vocabulary_resource_create()
- _taxonomy_vocabulary_resource_update in resources/
taxonomy_resource.inc - Update a taxonomy vocabulary based on submitted values.
1 string reference to '_taxonomy_vocabulary_resource_create'
- _taxonomy_resource_definition in resources/
taxonomy_resource.inc - @file Link general taxonomy functionalities to services module.
File
- resources/
taxonomy_resource.inc, line 514 - Link general taxonomy functionalities to services module.
Code
function _taxonomy_vocabulary_resource_create($vocabulary) {
// Adds backwards compatability with regression fixed in #1083242
$vocabulary = _services_arg_value($vocabulary, 'vocabulary');
taxonomy_save_vocabulary($vocabulary);
return $vocabulary;
}