function _taxonomy_patterns_prepare_vocabulary in Patterns 7
Same name and namespace in other branches
- 7.2 patterns_components/components/taxonomy.inc \_taxonomy_patterns_prepare_vocabulary()
1 call to _taxonomy_patterns_prepare_vocabulary()
- taxonomy_patterns_prepare in patterns_components/
components/ taxonomy.inc
File
- patterns_components/
components/ taxonomy.inc, line 397 - Patterns component for taxonomy vocabularies and terms.
Code
function _taxonomy_patterns_prepare_vocabulary($action, $data) {
if ($action == PATTERNS_MODIFY) {
if (!isset($data['vid'])) {
// We are modifying the machine_name as well
if (isset($data['old_machine_name'])) {
$taxo = taxonomy_vocabulary_machine_name_load($data['old_machine_name']);
$vid = $taxo->vid;
}
elseif (isset($data['machine_name'])) {
$taxo = taxonomy_vocabulary_machine_name_load($data['machine_name']);
if (!empty($taxo)) {
$vid = $taxo->vid;
// The old_machine_name must be set equal to machine_name
$data['old_machine_name'] = $data['machine_name'];
}
}
if (!empty($vid)) {
$data['vid'] = $vid;
}
}
// End: vid missing
}
// End: PATTERNS_MODIFY
$default_weight = 0;
$default_hierarchy = 0;
if (!isset($data['weight'])) {
$data['weight'] = $default_weight;
}
if (!isset($data['hierarchy'])) {
$data['hierarchy'] = $default_hierarchy;
}
return $data;
}