You are here

public function ImceFM::groupItems in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/ImceFM.php \Drupal\imce\ImceFM::groupItems()

Groups the items by parent path and type.

2 calls to ImceFM::groupItems()
ImceFM::groupSelection in src/ImceFM.php
Returns selected items grouped by parent folder path.
ImceFM::validatePermissions in src/ImceFM.php
Checks parent folder permissions of the given items.

File

src/ImceFM.php, line 385

Class

ImceFM
Imce File Manager.

Namespace

Drupal\imce

Code

public function groupItems(array $items) {
  $group = [];
  foreach ($items as $item) {
    $path = $item->parent
      ->getPath();
    $type = $item->type == 'folder' ? 'subfolders' : 'files';
    $group[$path][$type][$item->name] = $item;
  }
  return $group;
}