You are here

private function GlossaryAZWidgetOrderProcessor::getResultGroup in Search API AZ Glossary 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/facets/processor/GlossaryAZWidgetOrderProcessor.php \Drupal\search_api_glossary\Plugin\facets\processor\GlossaryAZWidgetOrderProcessor::getResultGroup()
  2. 8.2 src/Plugin/facets/processor/GlossaryAZWidgetOrderProcessor.php \Drupal\search_api_glossary\Plugin\facets\processor\GlossaryAZWidgetOrderProcessor::getResultGroup()
  3. 8.3 src/Plugin/facets/processor/GlossaryAZWidgetOrderProcessor.php \Drupal\search_api_glossary\Plugin\facets\processor\GlossaryAZWidgetOrderProcessor::getResultGroup()

Returns glossary result group.

1 call to GlossaryAZWidgetOrderProcessor::getResultGroup()
GlossaryAZWidgetOrderProcessor::sortResults in src/Plugin/facets/processor/GlossaryAZWidgetOrderProcessor.php
Orders results and return the new order of results.

File

src/Plugin/facets/processor/GlossaryAZWidgetOrderProcessor.php, line 45

Class

GlossaryAZWidgetOrderProcessor
A processor that orders the results by display value.

Namespace

Drupal\search_api_glossary\Plugin\facets\processor

Code

private function getResultGroup(Result $result) {

  // Is it a number? or maybe grouped number eg 0-9 (technically a string).
  if ($result
    ->getRawValue() == '0-9' || ctype_digit($result
    ->getRawValue()) || is_int($result
    ->getRawValue())) {
    $group = 'glossaryaz_sort_09';
  }
  elseif ($result
    ->getRawValue() == 'All') {
    $group = 'glossaryaz_sort_all';
  }
  elseif (ctype_alpha($result
    ->getRawValue())) {
    $group = 'glossaryaz_sort_az';
  }
  else {
    $group = 'glossaryaz_sort_other';
  }
  return $group;
}