public function CurrentSearchItemText::execute in Facet API 6.3
Same name and namespace in other branches
- 7.2 contrib/current_search/plugins/current_search/item_text.inc \CurrentSearchItemText::execute()
- 7 contrib/current_search/plugins/current_search/item_text.inc \CurrentSearchItemText::execute()
Implements CurrentSearchItem::execute().
Overrides CurrentSearchItem::execute
File
- contrib/
current_search/ plugins/ current_search/ item_text.inc, line 16 - Plugin that adds custom text to the current search block.
Class
- CurrentSearchItemText
- Extension of CurrentSearchItem that displays all active items.
Code
public function execute(FacetapiAdapter $adapter) {
$data = array(
'facetapi_results' => array(
'facetapi_adapter' => $adapter,
),
);
// Determines plurality of string.
if ($this->settings['plural']) {
$condition = '[' . $this->settings['plural_condition'] . ']';
$count = (int) token_replace($condition, 'facetapi_results', $adapter);
if ($count != 1) {
$raw_text = $this->settings['text_plural'];
$translation_key = 'text_plural';
}
else {
$raw_text = $this->settings['text'];
$translation_key = 'text';
}
}
else {
$raw_text = $this->settings['text'];
$translation_key = 'text';
}
// Translates text, returns themed output.
$translated_text = $this
->translate($translation_key, $raw_text);
$variables = array(
'text' => filter_xss_admin(token_replace($translated_text, 'facetapi_results', $adapter)),
'wrapper' => $this->settings['wrapper'],
'element' => $this->settings['element'],
'css' => $this->settings['css'],
'class' => current_search_get_classes($this->settings['classes'], $data),
'options' => array(
'html' => TRUE,
),
);
return array(
'#value' => theme('current_search_text', $variables),
);
}