protected function getBatchRedirectUrl() : string
    {
        // default url
        $result = ['plugin' => $this->plugin, 'controller' => $this->name, 'action' => 'index'];

        $currentUrl = $this->request->getEnv('HTTP_ORIGIN') . $this->request->getRequestTarget();
        // if referer does not match current url, redirect to referer (delete action)
        if (false === strpos($this->referer(), $currentUrl)) {
            $result = $this->referer();
        }

        // use batch redirect url if provided (edit action)
        if ($this->request->getData('batch.redirect_url')) {
            $result = $this->request->getData('batch.redirect_url');
        }

        return Router::url($result);
    }