|
@@ -731,11 +731,13 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
|
|
foreach ($tree as $term) {
|
|
|
// dsm($term, "term");
|
|
|
|
|
|
+ if($term->field_used_on_advanced_search['und'][0]['value'] == 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
$children = taxonomy_get_children($term->tid, $vid);
|
|
|
// dsm($children, "children");
|
|
|
|
|
|
- if($term->field_used_on_advanced_search['und'][0]['value'] == 0
|
|
|
- || !count($children))
|
|
|
+ if(!count($children))
|
|
|
continue;
|
|
|
|
|
|
$form['slider']['voc-'.$vid]['tree-'.$term->tid] = array(
|
|
@@ -761,26 +763,29 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
|
|
|
|
|
$options = array();
|
|
|
foreach ($children as $tid => $child) {
|
|
|
- // $child = taxonomy_term_load($child->tid);
|
|
|
- // if($child->field_used_on_advanced_search['und'][0]['value'] == 0){
|
|
|
- // continue;
|
|
|
- // }
|
|
|
+ $child = taxonomy_term_load($child->tid);
|
|
|
+ // dsm($child, 'child');
|
|
|
+ if($child->field_used_on_advanced_search['und'][0]['value'] == 0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- $children2 = taxonomy_get_children($child->tid, $vid);
|
|
|
+ // $children2 = taxonomy_get_children($child->tid, $vid);
|
|
|
+ $children2 = taxonomy_get_children_all($child->tid, $vid);
|
|
|
// dsm($children2, "children2");
|
|
|
|
|
|
- if(count($children2))
|
|
|
- $options[$tid] = $child->name;
|
|
|
+ if(!count($children2))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ $options[$tid] = $child->name;
|
|
|
|
|
|
$classes2 = array("treelevel2", $child->tid);
|
|
|
|
|
|
$options2 = array();
|
|
|
$dflt_values2 = array();
|
|
|
foreach ($children2 as $tid2 => $child2) {
|
|
|
- // $child2 = taxonomy_term_load($child2->tid);
|
|
|
- // if($child2->field_used_on_advanced_search['und'][0]['value'] == 0){
|
|
|
- // continue;
|
|
|
- // }
|
|
|
+ $child2 = taxonomy_term_load($tid2);
|
|
|
+ if($child2->field_used_on_advanced_search['und'][0]['value'] == 0)
|
|
|
+ continue;
|
|
|
|
|
|
$options2[$tid2] = $child2->name;
|
|
|
|
|
@@ -832,6 +837,21 @@ function materio_search_api_advanced_search_form($form, &$form_state){
|
|
|
return $form;
|
|
|
}
|
|
|
|
|
|
+function taxonomy_get_children_all($tid, $vid = 0, $key = 'tid'){
|
|
|
+ $c = taxonomy_get_children($tid, $vid, $key);
|
|
|
+ $result = array();
|
|
|
+ foreach ($c as $t => $d){
|
|
|
+ $result[$t] = $d;
|
|
|
+ $below = taxonomy_get_children_all($t, $vid, $key);
|
|
|
+ if (!empty($below)) {
|
|
|
+ foreach ($below as $nt => $nd){
|
|
|
+ $result[$nt] = $nd;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $result;
|
|
|
+}
|
|
|
+
|
|
|
function materio_search_api_advanced_search_form_validate($form, &$form_state){
|
|
|
// dsm($form, '$form');
|
|
|
// dsm($form_state, '$form_state');
|