You are here

public static function SortArray::sortByTitleProperty in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Component/Utility/SortArray.php \Drupal\Component\Utility\SortArray::sortByTitleProperty()

Sorts a structured array by '#title' property.

Callback for uasort().

Parameters

array $a: First item for comparison. The compared items should be associative arrays that optionally include a '#title' key.

array $b: Second item for comparison.

Return value

int The comparison result for uasort().

File

lib/Drupal/Component/Utility/SortArray.php, line 89
Contains \Drupal\Component\Utility\SortArray.

Class

SortArray
Provides generic array sorting helper methods.

Namespace

Drupal\Component\Utility

Code

public static function sortByTitleProperty($a, $b) {
  return static::sortByKeyString($a, $b, '#title');
}