function rules_action_taxonomy_add_vocab_submit in Rules 6
Action: Create a new vocabulary submit handler.
Flatten the vocabulary settings so they can be passed to taxonomy_form_vocabulary().
Related topics
File
- rules/
modules/ taxonomy.rules_forms.inc, line 157 - Rules configuration forms for the taxonomy module.
Code
function rules_action_taxonomy_add_vocab_submit(&$settings, $form, $form_state) {
$vocab = array();
if (!empty($settings['vocab'])) {
foreach ($settings['vocab']['vocab'] as $key => $values) {
if (is_array($values)) {
if (!empty($values['nodes'])) {
// User array_filter for the nodes, otherwise all content types will
// be chosen.
$values['nodes'] = array_filter($values['nodes']);
}
$vocab += $values;
}
else {
$vocab[$key] = $values;
}
}
}
$settings = $vocab;
}