public function FieldsHelper::compareFieldLabels in Search API 8
Compares two fields for alphabetic sorting according to their labels.
Parameters
\Drupal\search_api\Item\FieldInterface $a: The first field.
\Drupal\search_api\Item\FieldInterface $b: The second field.
Return value
int -1, 0 or 1 if the first field should, respectively, be considered less than, equal to or greater than the second.
Overrides FieldsHelperInterface::compareFieldLabels
File
- src/
Utility/ FieldsHelper.php, line 500
Class
- FieldsHelper
- Provides helper methods for dealing with Search API fields and properties.
Namespace
Drupal\search_api\UtilityCode
public function compareFieldLabels(FieldInterface $a, FieldInterface $b) {
return strnatcasecmp($a
->getLabel(), $b
->getLabel());
}