You are here

function facetapi_i18n_string_list in Facet API 7

Implements hook_i18n_string_list().

File

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

Code

function facetapi_i18n_string_list($group) {
  $strings = $texts = array();
  if ($group == 'facetapi') {

    // Get all enabled facets by looping over all searchers and realms.
    foreach (facetapi_get_searcher_info() as $searcher => $searcher_info) {
      $adapter = facetapi_adapter_load($searcher_info['name']);
      foreach (facetapi_get_realm_info() as $realm) {

        // Retrieve the "Show more/fewer" strings from the facet settings.
        foreach ($adapter
          ->getEnabledFacets() as $facet) {
          $settings = $adapter
            ->getFacetSettings($facet, $realm);

          // Avoid adding duplicate strings by using the string itself as key.
          $strings['facetapi']['link_text'][$settings->settings['facet_more_text']]['text'] = $settings->settings['facet_more_text'];
          $strings['facetapi']['link_text'][$settings->settings['facet_fewer_text']]['text'] = $settings->settings['facet_fewer_text'];

          // If title has been overridden, we should translate it.
          if ($settings->settings['title_override']) {
            $strings['facetapi']['title_text'][$settings->settings['title']]['text'] = $settings->settings['title'];
          }
        }
      }
    }
  }
  return $strings;
}