You are here

function facetapi_realms_get in Facet API 6

Invokes hook_facetapi_realm_info(), returns realm definitions.

Parameters

$reset: A boolean flagging whether the static should be reset.

Return value

An array of realm definitions.

5 calls to facetapi_realms_get()
facetapi_admin_settings_form in ./facetapi.admin.inc
Administrative settings for Search Lucene Facets.
facetapi_delta_map_get in ./facetapi.widget.inc
Returns a "delta map", because sometimes our deltas are longer than 32 chars and need to be passed to md5(). Due to the block table's schema, deltas cannot be longer than 32 characters. However, md5 hashes are nasty as CSS IDs, so we…
facetapi_enabled_facets_get in ./facetapi.module
Returns facets enabled in a given realm. If the realm name is NULL, all facets that are enabled in at least one realm will be returned.
facetapi_facet_status_set in ./facetapi.module
Sets the enabled/disabled status of a facet. It is recommended that the facetapi_facet_enable() and facetapi_facet_disable() functions are used in favor of calling this function directly.
facetapi_realm_load in ./facetapi.module
Returns a single realm definition.

File

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

Code

function facetapi_realms_get($reset = FALSE) {
  static $realms;
  if (NULL === $realms || $reset) {

    // Gets realm info from hooks, merges with defaults.
    $realms = array();
    foreach (module_invoke_all('facetapi_realm_info') as $realm_name => $realm) {
      $defaults = array(
        'name' => $realm_name,
        'title' => $realm_name,
        'description' => '',
        'default widget' => '',
        'widget requirements' => array(),
        'weight' => 0,
        'sortable' => TRUE,
        'ui' => TRUE,
      );
      $realms[$realm_name] = array_merge($defaults, $realm);
    }

    // Invokes alter hook, sorts realms by weight.
    drupal_alter('facetapi_realm_info', $realms);
    uasort($realms, 'facetapi_sort_weight');
  }
  return $realms;
}