AdminController::delete - CategoriesController::delete

Created Diff never expires
9 हटाए गए
लाइनें
कुल
हटाया गया
शब्द
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diffchecker logo
Diffchecker Pro
36 लाइनें
7 जोड़े गए
लाइनें
कुल
जोड़ा गया
शब्द
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diffchecker logo
Diffchecker Pro
34 लाइनें
public function delete()
public function delete()
{
{
// Check for request forgeries
$this->checkToken();
$this->checkToken();


// Get items to remove from the request.
// Get items to remove from the request.
$cid = $this->input->get('cid', array(), 'array');
$cid = $this->input->get('cid', array(), 'array');
$extension = $this->input->getCmd('extension', null);


if (!is_array($cid) || count($cid) < 1)
if (!is_array($cid) || count($cid) < 1)
{
{
$this->app->getLogger()->warning(Text::_($this->text_prefix . '_NO_ITEM_SELECTED'), array('category' => 'jerror'));
$this->app->enqueueMessage(Text::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning');
}
}
else
else
{
{
// Get the model.
// Get the model.
/** @var \Joomla\Component\Categories\Administrator\Model\CategoryModel $model */
$model = $this->getModel();
$model = $this->getModel();


// Make sure the item ids are integers
// Make sure the item ids are integers
$cid = ArrayHelper::toInteger($cid);
$cid = ArrayHelper::toInteger($cid);


// Remove the items.
// Remove the items.
if ($model->delete($cid))
if ($model->delete($cid))
{
{
$this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
$this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
}
}
else
else
{
{
$this->setMessage($model->getError(), 'error');
$this->setMessage($model->getError());
}
}

// 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, false));
$this->setRedirect(Route::_('index.php?option=' . $this->option . '&extension=' . $extension, false));
}
}