diff --git facetapi.module facetapi.module
index c11218f..a22d8c1 100644
--- facetapi.module
+++ facetapi.module
@@ -287,6 +287,10 @@ function facetapi_theme() {
'render element' => 'element',
'file' => 'facetapi.admin.inc',
),
+ 'facetapi_item_list' => array(
+ 'variables' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array()),
+ 'file' => 'facetapi.theme.inc',
+ ),
);
}
diff --git facetapi.theme.inc facetapi.theme.inc
index 8eccab2..608d7c2 100644
--- facetapi.theme.inc
+++ facetapi.theme.inc
@@ -33,7 +33,7 @@ function theme_facetapi_title($variables) {
}
/**
- * Returns HTML for an active facet item.
+ * Returns HTML for an inactive facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', 'options', and
@@ -43,6 +43,10 @@ function theme_facetapi_title($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_inactive($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
+
// Builds accessible markup.
// @see http://drupal.org/node/1316580
$accessible_vars = array(
@@ -81,7 +85,7 @@ function theme_facetapi_count($variables) {
}
/**
- * Returns HTML for an inactive facet item.
+ * Returns HTML for an active facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', and 'options'. See
@@ -90,6 +94,9 @@ function theme_facetapi_count($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_active($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
// Sanitizes the link text if necessary.
$sanitize = empty($variables['options']['html']);
@@ -143,3 +150,74 @@ function theme_facetapi_accessible_markup($variables) {
$text = ($variables['active']) ? t('Remove @text filter', $vars) : t('Apply @text filter', $vars);
return '' . $text . '';
}
+
+/**
+ * Returns HTML for a list or nested list of items.
+ *
+ * An almost exact copy of theme_item_list, except is uses renderable arrays properly.
+ * See http://drupal.org/node/891112 Once that issue is resolved in core, this function
+ * can go away.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list. If an item is a
+ * string, then it is used as is. If an item is an array, then the "data"
+ * element of the array is used as the contents of the list item. If an item
+ * is an array with a "children" element, those children are displayed in a
+ * nested list. All other elements are treated as attributes of the list
+ * item element.
+ * - title: The title of the list.
+ * - type: The type of list to return (e.g. "ul", "ol").
+ * - attributes: The attributes applied to the list element.
+ */
+function theme_facetapi_item_list($variables) {
+ $items = $variables['items'];
+ $title = $variables['title'];
+ $type = $variables['type'];
+ $attributes = $variables['attributes'];
+
+ $output = '
';
+ if (isset($title)) {
+ $output .= '
' . $title . '
';
+ }
+
+ if (!empty($items)) {
+ $output .= "<$type" . drupal_attributes($attributes) . '>';
+ $num_items = count($items);
+ foreach ($items as $i => $item) {
+ $attributes = array();
+ $children = array();
+ $data = '';
+ if (is_array($item)) {
+ foreach ($item as $key => $value) {
+ if ($key == 'data') {
+ $data = $value;
+ }
+ elseif ($key == 'children') {
+ $children = $value;
+ }
+ else {
+ $attributes[$key] = $value;
+ }
+ }
+ }
+ else {
+ $data = $item;
+ }
+ if (count($children) > 0) {
+ // Render nested list.
+ $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
+ }
+ if ($i == 0) {
+ $attributes['class'][] = 'first';
+ }
+ if ($i == $num_items - 1) {
+ $attributes['class'][] = 'last';
+ }
+ $output .= '' . $data . "\n";
+ }
+ $output .= "$type>";
+ }
+ $output .= '';
+ return $output;
+}
\ No newline at end of file
diff --git plugins/facetapi/widget_links.inc plugins/facetapi/widget_links.inc
index 8c092f5..77096bf 100644
--- plugins/facetapi/widget_links.inc
+++ plugins/facetapi/widget_links.inc
@@ -28,7 +28,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Sets each item's theme hook, builds item list.
$this->setThemeHooks($element);
$element = array(
- '#theme' => 'item_list',
+ '#theme' => 'facetapi_item_list',
'#items' => $this->buildListItems($element),
'#attributes' => $this->build['#attributes'],
);
@@ -84,9 +84,11 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Initializes variables passed to theme hook.
$variables = array(
+ '#theme' => $item['#theme'],
'text' => $item['#markup'],
'path' => $item['#path'],
'count' => $item['#count'],
+ 'indexed_value' => $item['#indexed_value'],
'options' => array(
'attributes' => $attributes,
'html' => $item['#html'],
@@ -120,7 +122,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
$variables['options']['attributes']['class'][] = $class;
// Themes the link, adds row to items.
- $row['data'] = theme($item['#theme'], $variables);
+ $row['data'] = $variables;
$items[] = $row;
}
diff --git contrib/current_search/plugins/current_search/item_active.inc contrib/current_search/plugins/current_search/item_active.inc
index a3d0879..14df5db 100644
--- contrib/current_search/plugins/current_search/item_active.inc
+++ contrib/current_search/plugins/current_search/item_active.inc
@@ -56,7 +56,7 @@ class CurrentSearchItemActive extends CurrentSearchItem {
if ($items) {
$classes = ($this->settings['css']) ? current_search_get_classes($this->settings['classes']) : array();
return array(
- '#theme' => 'item_list',
+ '#theme' => 'facetapi_item_list',
'#items' => $items,
'#attributes' => array('class' => $classes),
);
diff --git facetapi.module facetapi.module
index c11218f..a22d8c1 100644
--- facetapi.module
+++ facetapi.module
@@ -287,6 +287,10 @@ function facetapi_theme() {
'render element' => 'element',
'file' => 'facetapi.admin.inc',
),
+ 'facetapi_item_list' => array(
+ 'variables' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array()),
+ 'file' => 'facetapi.theme.inc',
+ ),
);
}
diff --git facetapi.theme.inc facetapi.theme.inc
index 8eccab2..608d7c2 100644
--- facetapi.theme.inc
+++ facetapi.theme.inc
@@ -33,7 +33,7 @@ function theme_facetapi_title($variables) {
}
/**
- * Returns HTML for an active facet item.
+ * Returns HTML for an inactive facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', 'options', and
@@ -43,6 +43,10 @@ function theme_facetapi_title($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_inactive($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
+
// Builds accessible markup.
// @see http://drupal.org/node/1316580
$accessible_vars = array(
@@ -81,7 +85,7 @@ function theme_facetapi_count($variables) {
}
/**
- * Returns HTML for an inactive facet item.
+ * Returns HTML for an active facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', and 'options'. See
@@ -90,6 +94,9 @@ function theme_facetapi_count($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_active($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
// Sanitizes the link text if necessary.
$sanitize = empty($variables['options']['html']);
@@ -143,3 +150,74 @@ function theme_facetapi_accessible_markup($variables) {
$text = ($variables['active']) ? t('Remove @text filter', $vars) : t('Apply @text filter', $vars);
return '' . $text . '';
}
+
+/**
+ * Returns HTML for a list or nested list of items.
+ *
+ * An almost exact copy of theme_item_list, except is uses renderable arrays properly.
+ * See http://drupal.org/node/891112 Once that issue is resolved in core, this function
+ * can go away.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list. If an item is a
+ * string, then it is used as is. If an item is an array, then the "data"
+ * element of the array is used as the contents of the list item. If an item
+ * is an array with a "children" element, those children are displayed in a
+ * nested list. All other elements are treated as attributes of the list
+ * item element.
+ * - title: The title of the list.
+ * - type: The type of list to return (e.g. "ul", "ol").
+ * - attributes: The attributes applied to the list element.
+ */
+function theme_facetapi_item_list($variables) {
+ $items = $variables['items'];
+ $title = $variables['title'];
+ $type = $variables['type'];
+ $attributes = $variables['attributes'];
+
+ $output = '';
+ if (isset($title)) {
+ $output .= '
' . $title . '
';
+ }
+
+ if (!empty($items)) {
+ $output .= "<$type" . drupal_attributes($attributes) . '>';
+ $num_items = count($items);
+ foreach ($items as $i => $item) {
+ $attributes = array();
+ $children = array();
+ $data = '';
+ if (is_array($item)) {
+ foreach ($item as $key => $value) {
+ if ($key == 'data') {
+ $data = $value;
+ }
+ elseif ($key == 'children') {
+ $children = $value;
+ }
+ else {
+ $attributes[$key] = $value;
+ }
+ }
+ }
+ else {
+ $data = $item;
+ }
+ if (count($children) > 0) {
+ // Render nested list.
+ $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
+ }
+ if ($i == 0) {
+ $attributes['class'][] = 'first';
+ }
+ if ($i == $num_items - 1) {
+ $attributes['class'][] = 'last';
+ }
+ $output .= '' . $data . "\n";
+ }
+ $output .= "$type>";
+ }
+ $output .= '';
+ return $output;
+}
\ No newline at end of file
diff --git plugins/facetapi/widget_links.inc plugins/facetapi/widget_links.inc
index 8c092f5..77096bf 100644
--- plugins/facetapi/widget_links.inc
+++ plugins/facetapi/widget_links.inc
@@ -28,7 +28,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Sets each item's theme hook, builds item list.
$this->setThemeHooks($element);
$element = array(
- '#theme' => 'item_list',
+ '#theme' => 'facetapi_item_list',
'#items' => $this->buildListItems($element),
'#attributes' => $this->build['#attributes'],
);
@@ -84,9 +84,11 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Initializes variables passed to theme hook.
$variables = array(
+ '#theme' => $item['#theme'],
'text' => $item['#markup'],
'path' => $item['#path'],
'count' => $item['#count'],
+ 'indexed_value' => $item['#indexed_value'],
'options' => array(
'attributes' => $attributes,
'html' => $item['#html'],
@@ -120,7 +122,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
$variables['options']['attributes']['class'][] = $class;
// Themes the link, adds row to items.
- $row['data'] = theme($item['#theme'], $variables);
+ $row['data'] = $variables;
$items[] = $row;
}
diff --git facetapi.module facetapi.module
index c11218f..a22d8c1 100644
--- facetapi.module
+++ facetapi.module
@@ -287,6 +287,10 @@ function facetapi_theme() {
'render element' => 'element',
'file' => 'facetapi.admin.inc',
),
+ 'facetapi_item_list' => array(
+ 'variables' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array()),
+ 'file' => 'facetapi.theme.inc',
+ ),
);
}
diff --git facetapi.theme.inc facetapi.theme.inc
index 8eccab2..a58d3d3 100644
--- facetapi.theme.inc
+++ facetapi.theme.inc
@@ -33,7 +33,7 @@ function theme_facetapi_title($variables) {
}
/**
- * Returns HTML for an active facet item.
+ * Returns HTML for an inactive facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', 'options', and
@@ -43,6 +43,10 @@ function theme_facetapi_title($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_inactive($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
+
// Builds accessible markup.
// @see http://drupal.org/node/1316580
$accessible_vars = array(
@@ -81,7 +85,7 @@ function theme_facetapi_count($variables) {
}
/**
- * Returns HTML for an inactive facet item.
+ * Returns HTML for an active facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', and 'options'. See
@@ -90,6 +94,9 @@ function theme_facetapi_count($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_active($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
// Sanitizes the link text if necessary.
$sanitize = empty($variables['options']['html']);
@@ -143,3 +150,74 @@ function theme_facetapi_accessible_markup($variables) {
$text = ($variables['active']) ? t('Remove @text filter', $vars) : t('Apply @text filter', $vars);
return '' . $text . '';
}
+
+/**
+ * Returns HTML for a list or nested list of items.
+ *
+ * An almost exact copy of theme_item_list, except is uses renderable arrays properly.
+ * See http://drupal.org/node/891112 Once that issue is resolved in core, this function
+ * can go away.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list. If an item is a
+ * string, then it is used as is. If an item is an array, then the "data"
+ * element of the array is used as the contents of the list item. If an item
+ * is an array with a "children" element, those children are displayed in a
+ * nested list. All other elements are treated as attributes of the list
+ * item element.
+ * - title: The title of the list.
+ * - type: The type of list to return (e.g. "ul", "ol").
+ * - attributes: The attributes applied to the list element.
+ */
+function theme_facetapi_item_list($variables) {
+ $items = $variables['items'];
+ $title = $variables['title'];
+ $type = $variables['type'];
+ $attributes = $variables['attributes'];
+
+ $output = '';
+ if (isset($title)) {
+ $output .= '
' . $title . '
';
+ }
+
+ if (!empty($items)) {
+ $output .= "<$type" . drupal_attributes($attributes) . '>';
+ $num_items = count($items);
+ foreach ($items as $i => $item) {
+ $attributes = array();
+ $children = array();
+ $data = '';
+ if (is_array($item)) {
+ foreach ($item as $key => $value) {
+ if ($key == 'data') {
+ $data = render($value);
+ }
+ elseif ($key == 'children') {
+ $children = $value;
+ }
+ else {
+ $attributes[$key] = $value;
+ }
+ }
+ }
+ else {
+ $data = $item;
+ }
+ if (count($children) > 0) {
+ // Render nested list.
+ $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
+ }
+ if ($i == 0) {
+ $attributes['class'][] = 'first';
+ }
+ if ($i == $num_items - 1) {
+ $attributes['class'][] = 'last';
+ }
+ $output .= '' . $data . "\n";
+ }
+ $output .= "$type>";
+ }
+ $output .= '';
+ return $output;
+}
\ No newline at end of file
diff --git plugins/facetapi/widget_links.inc plugins/facetapi/widget_links.inc
index 8c092f5..77096bf 100644
--- plugins/facetapi/widget_links.inc
+++ plugins/facetapi/widget_links.inc
@@ -28,7 +28,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Sets each item's theme hook, builds item list.
$this->setThemeHooks($element);
$element = array(
- '#theme' => 'item_list',
+ '#theme' => 'facetapi_item_list',
'#items' => $this->buildListItems($element),
'#attributes' => $this->build['#attributes'],
);
@@ -84,9 +84,11 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Initializes variables passed to theme hook.
$variables = array(
+ '#theme' => $item['#theme'],
'text' => $item['#markup'],
'path' => $item['#path'],
'count' => $item['#count'],
+ 'indexed_value' => $item['#indexed_value'],
'options' => array(
'attributes' => $attributes,
'html' => $item['#html'],
@@ -120,7 +122,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
$variables['options']['attributes']['class'][] = $class;
// Themes the link, adds row to items.
- $row['data'] = theme($item['#theme'], $variables);
+ $row['data'] = $variables;
$items[] = $row;
}
diff --git facetapi.module facetapi.module
index c11218f..a22d8c1 100644
--- facetapi.module
+++ facetapi.module
@@ -287,6 +287,10 @@ function facetapi_theme() {
'render element' => 'element',
'file' => 'facetapi.admin.inc',
),
+ 'facetapi_item_list' => array(
+ 'variables' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array()),
+ 'file' => 'facetapi.theme.inc',
+ ),
);
}
diff --git facetapi.theme.inc facetapi.theme.inc
index 8eccab2..a58d3d3 100644
--- facetapi.theme.inc
+++ facetapi.theme.inc
@@ -33,7 +33,7 @@ function theme_facetapi_title($variables) {
}
/**
- * Returns HTML for an active facet item.
+ * Returns HTML for an inactive facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', 'options', and
@@ -43,6 +43,10 @@ function theme_facetapi_title($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_inactive($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
+
// Builds accessible markup.
// @see http://drupal.org/node/1316580
$accessible_vars = array(
@@ -81,7 +85,7 @@ function theme_facetapi_count($variables) {
}
/**
- * Returns HTML for an inactive facet item.
+ * Returns HTML for an active facet item.
*
* @param $variables
* An associative array containing the keys 'text', 'path', and 'options'. See
@@ -90,6 +94,9 @@ function theme_facetapi_count($variables) {
* @ingroup themeable
*/
function theme_facetapi_link_active($variables) {
+ if (isset($variables[''])) {
+ $variables = $variables[''];
+ }
// Sanitizes the link text if necessary.
$sanitize = empty($variables['options']['html']);
@@ -143,3 +150,74 @@ function theme_facetapi_accessible_markup($variables) {
$text = ($variables['active']) ? t('Remove @text filter', $vars) : t('Apply @text filter', $vars);
return '' . $text . '';
}
+
+/**
+ * Returns HTML for a list or nested list of items.
+ *
+ * An almost exact copy of theme_item_list, except is uses renderable arrays properly.
+ * See http://drupal.org/node/891112 Once that issue is resolved in core, this function
+ * can go away.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list. If an item is a
+ * string, then it is used as is. If an item is an array, then the "data"
+ * element of the array is used as the contents of the list item. If an item
+ * is an array with a "children" element, those children are displayed in a
+ * nested list. All other elements are treated as attributes of the list
+ * item element.
+ * - title: The title of the list.
+ * - type: The type of list to return (e.g. "ul", "ol").
+ * - attributes: The attributes applied to the list element.
+ */
+function theme_facetapi_item_list($variables) {
+ $items = $variables['items'];
+ $title = $variables['title'];
+ $type = $variables['type'];
+ $attributes = $variables['attributes'];
+
+ $output = '';
+ if (isset($title)) {
+ $output .= '
' . $title . '
';
+ }
+
+ if (!empty($items)) {
+ $output .= "<$type" . drupal_attributes($attributes) . '>';
+ $num_items = count($items);
+ foreach ($items as $i => $item) {
+ $attributes = array();
+ $children = array();
+ $data = '';
+ if (is_array($item)) {
+ foreach ($item as $key => $value) {
+ if ($key == 'data') {
+ $data = render($value);
+ }
+ elseif ($key == 'children') {
+ $children = $value;
+ }
+ else {
+ $attributes[$key] = $value;
+ }
+ }
+ }
+ else {
+ $data = $item;
+ }
+ if (count($children) > 0) {
+ // Render nested list.
+ $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
+ }
+ if ($i == 0) {
+ $attributes['class'][] = 'first';
+ }
+ if ($i == $num_items - 1) {
+ $attributes['class'][] = 'last';
+ }
+ $output .= '' . $data . "\n";
+ }
+ $output .= "$type>";
+ }
+ $output .= '';
+ return $output;
+}
\ No newline at end of file
diff --git plugins/facetapi/widget_links.inc plugins/facetapi/widget_links.inc
index 8c092f5..8a751c4 100644
--- plugins/facetapi/widget_links.inc
+++ plugins/facetapi/widget_links.inc
@@ -28,7 +28,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Sets each item's theme hook, builds item list.
$this->setThemeHooks($element);
$element = array(
- '#theme' => 'item_list',
+ '#theme' => 'facetapi_item_list',
'#items' => $this->buildListItems($element),
'#attributes' => $this->build['#attributes'],
);
@@ -76,17 +76,18 @@ class FacetapiWidgetLinks extends FacetapiWidget {
// Initializes links attributes, adds rel="nofollow" if configured.
$attributes = ($settings['nofollow']) ? array('rel' => 'nofollow') : array();
$attributes += array('class' => $this->getItemClasses());
-
// Builds rows.
$items = array();
foreach ($build as $value => $item) {
$row = array('class' => array());
-
// Initializes variables passed to theme hook.
$variables = array(
+ '#theme' => $item['#theme'],
'text' => $item['#markup'],
'path' => $item['#path'],
'count' => $item['#count'],
+ 'indexed_value' => $item['#indexed_value'],
+ 'facet' => $this->settings->facet,
'options' => array(
'attributes' => $attributes,
'html' => $item['#html'],
@@ -120,7 +121,7 @@ class FacetapiWidgetLinks extends FacetapiWidget {
$variables['options']['attributes']['class'][] = $class;
// Themes the link, adds row to items.
- $row['data'] = theme($item['#theme'], $variables);
+ $row['data'] = $variables;
$items[] = $row;
}