You are here

public function FacetSourcePluginBase::getCount in Facets 8

Returns the number of results that were found for this search.

Return value

string The path of the facet.

Overrides FacetSourcePluginInterface::getCount

1 method overrides FacetSourcePluginBase::getCount()
SearchApiDisplay::getCount in src/Plugin/facets/facet_source/SearchApiDisplay.php
Returns the number of results that were found for this search.

File

src/FacetSource/FacetSourcePluginBase.php, line 129

Class

FacetSourcePluginBase
Defines a base class from which other facet sources may extend.

Namespace

Drupal\facets\FacetSource

Code

public function getCount() {
  global $pager_total_items;

  // Exposing a global here. This is pretty ugly but the only way to get the
  // actual results for any kind of query that was done and gets back results.
  // @see core/includes/pager.inc for more information how this works.
  // Rounding as some backend plugins could not give accurate information on
  // the results found.
  // @todo Figure out when it can not be the first one in the list.
  return round($pager_total_items[0]);
}