Commit 10f4cf2e authored by git's avatar git Committed by borisson_

Issue #2950094 by waluigi, Berdir, dermario: add template suggestions for...

Issue #2950094 by waluigi, Berdir, dermario: add template suggestions for facets-result-item-list.html.twig based on widget type and facet ID
parent 6708fa6c
......@@ -47,7 +47,6 @@ function facets_help($route_name, RouteMatchInterface $route_match) {
function facets_theme($existing, $type, $theme, $path) {
return [
'facets_result_item' => [
'base hook' => 'facets_result_item',
'variables' => [
'facet' => NULL,
'raw_value' => '',
......@@ -420,3 +419,14 @@ function facets_form_facets_facet_form_alter(&$form, FormStateInterface $form_st
unset($form['actions']);
}
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function facets_theme_suggestions_facets_result_item(array $variables) {
$suggestions = [];
$facet = $variables['facet'];
$suggestions[] = 'facets_result_item__' . $facet->getWidget()['type'];
$suggestions[] = 'facets_result_item__' . $facet->getWidget()['type'] . '__' . $facet->id();
return $suggestions;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment