Loading facets.module +14 −2 Original line number Diff line number Diff line Loading @@ -10,10 +10,12 @@ use Drupal\Core\Breadcrumb\Breadcrumb; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Site\Settings; use Drupal\Core\Url; use Drupal\facets\Entity\Facet; use Drupal\facets\Entity\FacetSource; use Drupal\facets\FacetInterface; use Drupal\facets\FacetSource\SearchApiFacetSourceInterface; use Drupal\views\Entity\View; use Drupal\Core\Entity\EntityInterface; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; Loading Loading @@ -202,8 +204,18 @@ function facets_entity_predelete(EntityInterface $entity) { * @see https://www.drupal.org/node/1842756 */ function facets_preprocess_facets_item_list(array &$variables) { if ($variables['facet'] !== NULL && $variables['facet']->get('show_title') === TRUE) { $variables['title'] = $variables['facet']->label(); /** @var FacetInterface $facet */ $facet = $variables['facet']; if ($facet !== NULL) { if ($facet->get('show_title') === TRUE) { $variables['title'] = $facet->label(); } if (Settings::get('facets_debug_cacheable_metadata', FALSE) && $facet->getFacetSource() instanceof SearchApiFacetSourceInterface) { $variables['cache_hash'] = $hash = substr(base_convert(hash('sha256', uniqid(time())), 16, 36), 0, 6); $variables['cache_contexts'] = implode(', ', $facet->getCacheContexts()); $variables['cache_tags'] = implode(', ', $facet->getCacheTags()); $variables['cache_max_age'] = $facet->getCacheMaxAge(); } } template_preprocess_item_list($variables); } Loading templates/facets-item-list.html.twig +14 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,20 @@ * @ingroup themeable */ #} {% if cache_hash %} <!-- facets cacheable metadata hash: {{ cache_hash }} {% if cache_contexts %} contexts: {{ cache_contexts }} {%- endif %} {% if cache_tags %} tags: {{ cache_tags }} {%- endif %} {% if cache_max_age %} max age: {{ cache_max_age }} {%- endif %} --> {%- endif %} <div class="facets-widget- {{- facet.widget.type -}} "> {% if facet.widget.type %} {%- set attributes = attributes.addClass('item-list__' ~ facet.widget.type) %} Loading Loading
facets.module +14 −2 Original line number Diff line number Diff line Loading @@ -10,10 +10,12 @@ use Drupal\Core\Breadcrumb\Breadcrumb; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Site\Settings; use Drupal\Core\Url; use Drupal\facets\Entity\Facet; use Drupal\facets\Entity\FacetSource; use Drupal\facets\FacetInterface; use Drupal\facets\FacetSource\SearchApiFacetSourceInterface; use Drupal\views\Entity\View; use Drupal\Core\Entity\EntityInterface; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; Loading Loading @@ -202,8 +204,18 @@ function facets_entity_predelete(EntityInterface $entity) { * @see https://www.drupal.org/node/1842756 */ function facets_preprocess_facets_item_list(array &$variables) { if ($variables['facet'] !== NULL && $variables['facet']->get('show_title') === TRUE) { $variables['title'] = $variables['facet']->label(); /** @var FacetInterface $facet */ $facet = $variables['facet']; if ($facet !== NULL) { if ($facet->get('show_title') === TRUE) { $variables['title'] = $facet->label(); } if (Settings::get('facets_debug_cacheable_metadata', FALSE) && $facet->getFacetSource() instanceof SearchApiFacetSourceInterface) { $variables['cache_hash'] = $hash = substr(base_convert(hash('sha256', uniqid(time())), 16, 36), 0, 6); $variables['cache_contexts'] = implode(', ', $facet->getCacheContexts()); $variables['cache_tags'] = implode(', ', $facet->getCacheTags()); $variables['cache_max_age'] = $facet->getCacheMaxAge(); } } template_preprocess_item_list($variables); } Loading
templates/facets-item-list.html.twig +14 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,20 @@ * @ingroup themeable */ #} {% if cache_hash %} <!-- facets cacheable metadata hash: {{ cache_hash }} {% if cache_contexts %} contexts: {{ cache_contexts }} {%- endif %} {% if cache_tags %} tags: {{ cache_tags }} {%- endif %} {% if cache_max_age %} max age: {{ cache_max_age }} {%- endif %} --> {%- endif %} <div class="facets-widget- {{- facet.widget.type -}} "> {% if facet.widget.type %} {%- set attributes = attributes.addClass('item-list__' ~ facet.widget.type) %} Loading