W3cubDocs

/Drupal 8

public static function SortArray::sortByTitleProperty

public static SortArray::sortByTitleProperty($a, $b)

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

core/lib/Drupal/Component/Utility/SortArray.php, line 84

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');
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!SortArray.php/function/SortArray::sortByTitleProperty/8.1.x