function content_taxonomy_activeselect_field_load in Content Taxonomy 5
adding of terms when node is loaded (called by content_taxonomy)
File
- ./
content_taxonomy_activeselect.module, line 256 - Defines a widget type for content_taxonomy with activeselects
Code
function content_taxonomy_activeselect_field_load($op, &$node, $field, &$node_field, &$additions, $teaser, $page) {
$additions = array();
$default_terms = array();
$children_terms = array();
$grandchildren_terms = array();
$default_terms = content_taxonomy_terms_by_field($node, $field['vid'], $field['tid'], 1);
$additions[$field['field_name']]['default_tid'] = array_keys($default_terms);
$default_terms = array_values($default_terms);
$children_terms = content_taxonomy_terms_by_field($node, $field['vid'], $default_terms[0]->tid, 1);
if (is_array($children_terms)) {
$additions[$field['field_name']]['default_children'] = array();
$additions[$field['field_name']]['default_children'] = array_keys($children_terms);
$children_terms = array_values($children_terms);
if ($field['widget']['grandchildren']) {
$grandchildren_terms = content_taxonomy_terms_by_field($node, $field['vid'], $children_terms[0]->tid, 1);
if (is_array($grandchildren_terms)) {
$additions[$field['field_name']]['default_grandchildren'] = array();
$additions[$field['field_name']]['default_grandchildren'] = array_keys($grandchildren_terms);
}
}
}
}