public static SortArray::sortByWeightElement(array $a, array $b)
Sorts a structured array by the 'weight' element.
Note that the sorting is by the 'weight' array element, not by the render element property '#weight'.
Callback for uasort().
array $a: First item for comparison. The compared items should be associative arrays that optionally include a 'weight' element. For items without a 'weight' element, a default value of 0 will be used.
array $b: Second item for comparison.
int The comparison result for uasort().
public static function sortByWeightElement(array $a, array $b) { return static::sortByKeyInt($a, $b, 'weight'); }
© 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::sortByWeightElement/8.1.x