开发者

Drupal 7 on search: multiple select box as dropdown with checkboxes (or something)

开发者 https://www.devze.com 2023-04-12 15:17 出处:网络
D7 Install Relevant Modules: Views, Search API, Solr integration module, Facet search,开发者_运维问答

D7 Install Relevant Modules: Views, Search API, Solr integration module, Facet search,开发者_运维问答

I am trying to streamline search functionality to include a keyword search, and a multiple select drop down box. I'm using the faceted search box.


Use the attribute "multiple" with the value TRUE/FALSE for enable/disable the multi select options in the drupal drop down select field. If the value TRUE is set to the attribute "multiple", then it enables the multi select option. Please refer the below code for multiselect drop down.

$all_users = entity_load('user');
foreach($all_users as $value) {
  $user_list = (array)$value;
  if($user_list['uid'] > 1) {
    $users[$user_list['uid']] = $user_list['name'];
  }
}
$form['accessible_users'] = array(
  '#type' => 'select',
  '#options' => $users,
  '#title' => t('Accessible Users'),
  '#multiple' => TRUE,
  '#description' => t('Slect the users who have rights to access this article.'),
);

If you couldn't clear with my answer , please refer the Drupal api page

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号