function FieldUiTable::reduceOrder
Same name in other branches
- 8.9.x core/modules/field_ui/src/Element/FieldUiTable.php \Drupal\field_ui\Element\FieldUiTable::reduceOrder()
- 10 core/modules/field_ui/src/Element/FieldUiTable.php \Drupal\field_ui\Element\FieldUiTable::reduceOrder()
- 11.x core/modules/field_ui/src/Element/FieldUiTable.php \Drupal\field_ui\Element\FieldUiTable::reduceOrder()
Determines the rendering order of an array representing a tree.
Callback for array_reduce() within ::tablePreRender().
Parameters
mixed $array: Holds the return value of the previous iteration; in the case of the first iteration it instead holds the value of the initial array.
mixed $a: Holds the value of the current iteration.
Return value
array Array where rendering order has been determined.
File
-
core/
modules/ field_ui/ src/ Element/ FieldUiTable.php, line 229
Class
- FieldUiTable
- Provides a field_ui table element.
Namespace
Drupal\field_ui\ElementCode
public static function reduceOrder($array, $a) {
$array = !$array ? [] : $array;
if (!empty($a['name'])) {
$array[] = $a['name'];
}
if (!empty($a['children'])) {
uasort($a['children'], [
'Drupal\\Component\\Utility\\SortArray',
'sortByWeightElement',
]);
$array = array_merge($array, array_reduce($a['children'], [
static::class,
'reduceOrder',
]));
}
return $array;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.