diff --git a/facetapi.module b/facetapi.module index 2e594de..9e67ffd 100644 --- a/facetapi.module +++ b/facetapi.module @@ -258,6 +258,10 @@ function facetapi_ctools_plugin_type() { */ function facetapi_theme() { return array( + 'facetapi_widget_links' => array( + 'render element' => 'element', + 'file' => 'facetapi.theme.inc', + ), 'facetapi_title' => array( 'variables' => array('title' => NULL, 'facet' => array()), 'file' => 'facetapi.theme.inc', diff --git a/facetapi.theme.inc b/facetapi.theme.inc index f984731..cbdb4a9 100644 --- a/facetapi.theme.inc +++ b/facetapi.theme.inc @@ -6,6 +6,22 @@ */ /** + * Returns HTML for a widget_links widget. + * + * @param $variables + * An associative array containing: + * - element: A render element representing the form. + * + * @ingroup themeable + */ +function theme_facetapi_widget_links($variables) { + $element = $variables['element']; + $element['#theme'] = 'item_list'; + + return drupal_render($element); +} + +/** * Returns HTML for a "missing" facet link. * * @param $variables diff --git a/plugins/facetapi/widget_links.inc b/plugins/facetapi/widget_links.inc index 06fca14..934aced 100644 --- a/plugins/facetapi/widget_links.inc +++ b/plugins/facetapi/widget_links.inc @@ -9,7 +9,8 @@ * Widget that renders facets as a list of clickable links. * * Links make it easy for users to narrow down their search results by clicking - * on them. The render arrays use theme_item_list() to generate the HTML markup. + * on them. The render arrays use theme_facetapi_widget_links() to generate the + * HTML markup via theme_item_list(). */ class FacetapiWidgetLinks extends FacetapiWidget { @@ -42,9 +43,11 @@ class FacetapiWidgetLinks extends FacetapiWidget { // Sets each item's theme hook, builds item list. $this->setThemeHooks($element); $element = array( - '#theme' => 'item_list', + '#theme' => 'facetapi_widget_links', '#items' => $this->buildListItems($element), '#attributes' => $this->build['#attributes'], + '#build' => $element, + '#widget' => $this, ); }