SortArray
class SortArray (View source)
Provides generic array sorting helper methods.
Methods
Sorts a structured array by the 'weight' element.
Sorts a structured array by '#weight' property.
Sorts a structured array by 'title' key (no # prefix).
Sorts a structured array by '#title' property.
Sorts a string array item by an arbitrary key.
Sorts an integer array item by an arbitrary key.
Details
static int
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().
static int
sortByWeightProperty(array $a, array $b)
Sorts a structured array by '#weight' property.
Callback for uasort().
static int
sortByTitleElement(array $a, array $b)
Sorts a structured array by 'title' key (no # prefix).
Callback for uasort().
static int
sortByTitleProperty(array $a, array $b)
Sorts a structured array by '#title' property.
Callback for uasort().
static int
sortByKeyString(array $a, array $b, string $key)
Sorts a string array item by an arbitrary key.
static int
sortByKeyInt(array $a, array $b, string $key)
Sorts an integer array item by an arbitrary key.