You are here

function facetapi_widget_checkboxes in Facet API 6

Builds items as checkbox form elemets.

Parameters

&$build: The facet's render array.

&$key: A string containing the key the facet's render array will be appended to.

&$settings: An array containing the JavaScript settings.

1 string reference to 'facetapi_widget_checkboxes'
facetapi_facetapi_widget_info in ./facetapi.module
Implementation of hook_facetapi_widget_info().

File

./facetapi.widget.inc, line 67
Widget callbacks and building functions.

Code

function facetapi_widget_checkboxes(array &$build, &$key, &$settings) {
  $build['#type'] = 'checkboxes';
  $build['#default_value'] = $build['#adapter']
    ->getActiveValues($build['#facet']);
  $build['#options'] = array_map('check_plain', facetapi_form_options_get($build));
  $build['#prefix'] = '<div class="criterion">';
  $build['#suffix'] = '</div>';
  unset($build[$build['#facet']['field alias']]);
}