function _content_taxonomy_taxonomy_unset in Content Taxonomy 6
Same name and namespace in other branches
- 6.2 content_taxonomy.module \_content_taxonomy_taxonomy_unset()
carefully unsets node or node form taxonomy items
Parameters
$form the node or node form's taxonomy selections. nodes are objects and forms are arrays, so only the actual taxonomy value or property is passed:
$vids an array containing a list of vocabulary IDs whose terms should be unset:
2 calls to _content_taxonomy_taxonomy_unset()
- content_taxonomy_field in ./
content_taxonomy.module - Implementation of hook_field().
- content_taxonomy_form_alter in ./
content_taxonomy.module - Implementation of hook_form_alter().
File
- ./
content_taxonomy.module, line 503 - Defines a field type for referencing a taxonomy term.
Code
function _content_taxonomy_taxonomy_unset(&$form, $vids) {
if (empty($vids) || !is_array($form)) {
return;
}
foreach ($form as $key => $value) {
if ($key == 'tags') {
_content_taxonomy_taxonomy_unset($form[$key], $vids);
}
elseif (is_object($value) && in_array($value->vid, $vids)) {
unset($form[$key]);
}
elseif (is_array($value) && in_array($key, $vids)) {
unset($form[$key]);
}
}
}