You are here

public function RawValueWidgetOrderProcessor::sortResults in Facets 8

Orders results and return the new order of results.

Parameters

\Drupal\facets\Result\Result $a: First result which should be compared.

\Drupal\facets\Result\Result $b: Second result which should be compared.

Return value

int -1, 0, or 1 depending which result

Overrides SortProcessorInterface::sortResults

File

src/Plugin/facets/processor/RawValueWidgetOrderProcessor.php, line 26

Class

RawValueWidgetOrderProcessor
A processor that orders the results by raw value.

Namespace

Drupal\facets\Plugin\facets\processor

Code

public function sortResults(Result $a, Result $b) {
  return strnatcasecmp($a
    ->getRawValue(), $b
    ->getRawValue());
}