I am trying to cycle through a select list on an exposed form filter and hide terms I don't need.
With my select box being called ttd-tid I tried:
foreach ($form['ttd_tid']['#options'] as $tid => $term){
if (in_array($tid,$child_terms_tids)){
//leave it
}else{
//remove it
unset($form['ttd_tid']['#options'][$tid]);
}
}
But $tid is not the option value. It seems to be the count.
I tried foreach ($form['ttd_tid']['#options']['option'] as $tid => $term){
But that didn't work either.
Essentially, I need to compare the value of the option to an array and hide it. And I can't seem to get it to work since $tid seems to be yet another array.
My $form array looks like this
Array ( [#info] => Array ( [filter-field_things_to_do_tags_tid] => Array ( [operator] => field_things_to_do_tags_tid_op [value] => ttd_tid [label] => Things to Do Tags [description] => ) ) [ttd_tid] => Array ( [#type] => select [#options] => Array ( [All] => - Any - [0] => stdClass Object ( [option] => Array ( [86] => Amusement Parks ) ) [1] => stdClass Object ( [option] => Array ( [63] => -Theme Parks ) ) [2] => stdClass Object ( [option] => Array ( [611] => -Water Parks ) ) [3] => stdClass Object ( [option] => Array ( [612] => Arts, Culture & History ) ) [4] => stdClass Object ( [option] => Array ( [1] => -Architecture & Landmarks ) ) [5] => stdClass Object ( [option] => Array ( [30] => -Galleries ) ) [6] => stdClass Object ( [option] => Array ( [32] => -History & Culture ) ) [7] => stdClass Object ( [option] => Array ( [83] => -Museums ) ) [8] => , etc, etc