You are here

public function ImceFolder::removeItem in IMCE 8.2

Same name and namespace in other branches
  1. 8 src/ImceFolder.php \Drupal\imce\ImceFolder::removeItem()

Removes an item from the item list.

File

src/ImceFolder.php, line 173

Class

ImceFolder
Imce Folder.

Namespace

Drupal\imce

Code

public function removeItem(ImceItem $item) {
  if ($this === $item->parent) {
    $item
      ->deselect();
    $item->parent = NULL;
    $name = $item->name;
    unset($this->items[$name]);
    if ($item->type === 'folder') {
      unset($this->subfolders[$name]);
      $item
        ->setPath(NULL);
    }
    else {
      unset($this->files[$name]);
    }
    return $item;
  }
}