You are here

public function DashboardStorage::loadMultipleOrderedByWeight in Dashboards with Layout Builder 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/DashboardStorage.php \Drupal\dashboards\Entity\DashboardStorage::loadMultipleOrderedByWeight()

File

src/Entity/DashboardStorage.php, line 19

Class

DashboardStorage
Class DashboardStorage.

Namespace

Drupal\dashboards\Entity

Code

public function loadMultipleOrderedByWeight(?array $ids = NULL) {
  $entites = parent::loadMultiple($ids);
  usort($entites, function ($a, $b) {
    return $a
      ->get('weight') <=> $b
      ->get('weight');
  });
  return $entites;
}