public function OverviewBase::reduceOrder

Determines the rendering order of an array representing a tree.

Callback for array_reduce() within \Drupal\field_ui\OverviewBase::tablePreRender().

File

drupal/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php, line 214
Contains \Drupal\field_ui\OverviewBase.

Class

OverviewBase
Abstract base class for Field UI overview forms.

Namespace

Drupal\field_ui

Code

public function reduceOrder($array, $a) {
  $array = !isset($array) ? array() : $array;
  if ($a['name']) {
    $array[] = $a['name'];
  }
  if (!empty($a['children'])) {
    uasort($a['children'], 'drupal_sort_weight');
    $array = array_merge($array, array_reduce($a['children'], array(
      $this,
      'reduceOrder',
    )));
  }
  return $array;
}