You are here

private function CustomFilter::sortRules in Custom filter 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/CustomFilter.php \Drupal\customfilter\Entity\CustomFilter::sortRules()

Sort an array by a column.

Parameters

array $arr: The array to be sorted.

Return value

$this

1 call to CustomFilter::sortRules()
CustomFilter::getRules in src/Entity/CustomFilter.php
Get all rules for same parent rule.

File

src/Entity/CustomFilter.php, line 286

Class

CustomFilter
Defines the entity for a filter in customfilter.

Namespace

Drupal\customfilter\Entity

Code

private function sortRules(array &$arr) {
  $sort_col = [];
  foreach ($arr as $key => $row) {
    $sort_col[$key] = $row['weight'];
  }
  array_multisort($sort_col, SORT_ASC, $arr);
  return $this;
}