You are here

function HOOK_facet_items_alter in Facet API Bonus 7

Hook to rewrite facet items: items of facets can be rewritten prior to rendering.

Parameters

array $build: An array of facet items you can rewrite.

$settings: Contains the facet filter settings as context to determine the facet and the search context.

File

./facetapi_bonus.api.php, line 16
Documentation of FacetAPI Bonus hooks.

Code

function HOOK_facet_items_alter(array &$build, &$settings) {

  // We're checking for our "Facet" and if the FacetAPI realm is "block".
  // For further details about FacetAPI realms, see: hook_facetapi_realm_info().
  if ($settings->facet == "YOUR_FACET_NAME" && $settings->realm == 'block') {

    // For each facat item, just rewrite its' markup.
    // For Taxonomy-based Facets, the item $key is (usually) the TermID.
    foreach ($build as $key => $item) {
      $build[$key]["#markup"] = drupal_strtoupper($item["#markup"]);
    }
  }
}