Ojs\CoreBundle\Service\GridAction::deleteAction PHP Method

deleteAction() public method

public deleteAction ( string $route, string $key = 'id', mixed $role = null, string $confirmMessage = 'sure' ) : APY\DataGridBundle\Grid\Action\RowAction
$route string
$key string
$role mixed
$confirmMessage string
return APY\DataGridBundle\Grid\Action\RowAction
    public function deleteAction($route, $key = 'id', $role = null, $confirmMessage = 'sure')
    {
        $rowAction = new RowAction('<i class="fa fa-trash-o"></i>', $route);
        $rowAction->setRouteParameters($key);
        $translator = $this->translator;
        $csrfTokenManager = $this->csrfTokenManager;
        $rowAction->manipulateRender(function (RowAction $action, Row $row) use($translator, $csrfTokenManager, $route, $confirmMessage) {
            $route = str_replace('_delete', '', $route);
            $token = $csrfTokenManager->getToken($route . $row->getPrimaryFieldValue());
            $action->setAttributes(['class' => 'btn btn-danger btn-xs delete', 'data-toggle' => 'tooltip', 'title' => $translator->trans("delete"), 'data-token' => $token, 'data-method' => 'delete', 'data-confirm' => $this->translator->trans($confirmMessage)]);
            return $action;
        });
        if ($role) {
            $rowAction->setRole($role);
        }
        return $rowAction;
    }