public function remove($item) { parent::remove($item); $ids = Session::get($this->itemsSessionKey()); if (is_null($ids)) { return; } unset($ids[$item->ID]); Session::set($this->itemsSessionKey(), $ids); }
/** * Remove this item from this list * @param {mixed} $item */ public function remove($item) { $id = $item; if (is_object($item)) { $id = $item->ID; } $stateItems = $this->gridField->State->StatefulListData->toArray(); if ($stateItems && count($stateItems) > 0) { foreach ($stateItems as $key => $value) { if ($value['ID'] == $id) { unset($stateItems[$key]); break; } } $this->gridField->State->StatefulListData = $stateItems; } parent::remove($id); }