public static function Element::order in Lightning Core 8.3
Same name and namespace in other branches
- 8.5 src/Element.php \Drupal\lightning_core\Element::order()
- 8 src/Element.php \Drupal\lightning_core\Element::order()
- 8.2 src/Element.php \Drupal\lightning_core\Element::order()
- 8.4 src/Element.php \Drupal\lightning_core\Element::order()
Puts an associative array into an arbitrary order.
Parameters
array $values: The array to reorder.
array $keys: The keys, in their desired order.
2 calls to Element::order()
- Element::toTail in src/
Element.php - Moves element(s) to the end of an associative array.
- ElementTest::testOrder in tests/
src/ Unit/ ElementTest.php - @covers ::order
File
- src/
Element.php, line 45
Class
- Element
- Helpful functions for dealing with renderable arrays and elements.
Namespace
Drupal\lightning_coreCode
public static function order(array &$values, array $keys) {
$keys = array_values($keys);
uksort($values, function ($a, $b) use ($keys) {
return array_search($a, $keys) - array_search($b, $keys);
});
}