You are here

public static function IndexAddFieldsForm::compareFieldLabels in Search API 8

Compares labels of property render arrays.

Used as an uasort() callback in \Drupal\search_api\Form\IndexAddFieldsForm::getPropertiesList().

Parameters

array $a: First property render array.

array $b: Second property render array.

Return value

int -1, 0 or 1 if the first array should be considered, respectively, less than, equal to or greater than the second.

File

src/Form/IndexAddFieldsForm.php, line 445

Class

IndexAddFieldsForm
Provides a form for adding fields to a search index.

Namespace

Drupal\search_api\Form

Code

public static function compareFieldLabels(array $a, array $b) {
  $a_title = (string) $a['label']['#markup'];
  $b_title = (string) $b['label']['#markup'];
  return strnatcasecmp($a_title, $b_title);
}