You are here

function facetapi_facet_widget_get in Facet API 6

Finds a facet's selected widget given the searcher and realm.

Parameters

$widgets: An array of widget definitions.

$searcher: A string containing the machine readable name of the searcher module.

$realm: An array containing the full realm definition.

$facet: An array containing the full realm definition.

Return value

A string containing the default widget.

2 calls to facetapi_facet_widget_get()
FacetapiFacet::build in ./facetapi.adapter.inc
Returns the facet's render array.
facetapi_facet_settings_form in ./facetapi.admin.inc
Returns settings for an individual facet that apply to a realm.

File

./facetapi.module, line 593
An abstracted facet API that can be used by various search backens.

Code

function facetapi_facet_widget_get(array $widgets, $searcher, array $realm, array $facet) {
  if (!($widget_name = facetapi_setting_get('widget', $searcher, $realm['name'], $facet['name']))) {
    foreach ($facet['default widgets'] as $default_widget) {
      if (isset($widgets[$default_widget])) {
        $widget_name = $default_widget;
        break;
      }
    }
    if (!$widget_name) {
      $widget_name = $realm['default widget'];
    }
  }
  return $widget_name;
}