function template_preprocess_search_api_form_item_list in Search API 8
Prepares variables for search_api_form_item_list form templates.
Default template: search-api-form-item-list.html.twig.
Parameters
array &$variables: Associative array of template variables, with the following structure:
- element: The element to be rendered, as an array, potentially containing a "#title" key, plus the list items as its children.
File
- ./
search_api.theme.inc, line 137 - Defines theme functions for the Search API module.
Code
function template_preprocess_search_api_form_item_list(array &$variables) {
$element = $variables['element'];
$variables['items'] = [
'#theme' => 'item_list',
];
if (!empty($element['#title'])) {
$variables['items']['#title'] = $element['#title'];
}
foreach (Element::children($element) as $key) {
$variables['items']['#items'][$key] = $element[$key];
}
}