/**
* Removes an item.
*
* @return void
*
* @since 1.6
*/
public function delete()
{
// Check for request forgeries
$this->checkToken();
// Get items to remove from the request.
$cid = (array) $this->input->get('cid', array(), 'int');
// Remove zero values resulting from input filter
$cid = array_filter($cid);
if (empty($cid)) {
$this->app->getLogger()->warning(Text::_($this->text_prefix . '_NO_ITEM_SELECTED'), array('category' => 'jerror'));
} else {
// Get the model.
$model = $this->getModel();
// Remove the items.
if ($model->delete($cid)) {
$this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', \count($cid)));
} else {
$this->setMessage($model->getError(), 'error');
}
// Invoke the postDelete method to allow for the child class to access the model.
$this->postDeleteHook($model, $cid);
}
$this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false));
}