欢迎各位兄弟 发布技术文章
这里的技术是共享的
$dropdown_source = taxonomy_get_tree(2);
$dropdown_array = array('0' => '--none--');
foreach ($dropdown_source as $item) {
$key = $item->tid;
$value = $item->name;
$dropdown_array[$key] = $value;
}
//location filter dropdown
$form['filterset']['locationfilter'] = array(
'#weight' => '1',
'#key_type' => 'associative',
'#multiple_toggle' => '1',
'#type' => 'select',
'#options' => $dropdown_array,
'#title' => 'Filter by location',
);
unset($dropdown_array);