src/Contao/View/Contao2BackendView/Controller/ClipboardController.php
private function clearClipboard(ActionEvent $event, $redirect = true)
    {
        $environment     = $event->getEnvironment();
        $eventDispatcher = $environment->getEventDispatcher();
        $clipboard       = $environment->getClipboard();
        $input           = $environment->getInputProvider();

        if ($clipboardId = $input->getParameter('clipboard-item')) {
            $clipboard->removeByClipboardId($clipboardId);
        } else {
            $clipboard->clear();
        }
        $clipboard->saveTo($environment);

        if (false === $redirect) {
            return;
        }

        $addToUrlEvent = new AddToUrlEvent('clipboard-item=&original-act=&act=' . $input->getParameter('original-act'));
        $eventDispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $addToUrlEvent);

        $redirectEvent = new RedirectEvent($addToUrlEvent->getUrl());
        $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $redirectEvent);
    }
private function clearClipboard(ActionEvent $event, $redirect = true)
    {
        $environment     = $event->getEnvironment();
        $eventDispatcher = $environment->getEventDispatcher();
        $clipboard       = $environment->getClipboard();
        $input           = $environment->getInputProvider();

        if ($clipboardId = $input->getParameter('clipboard-item')) {
            $clipboard->removeByClipboardId($clipboardId);
        } else {
            $clipboard->clear();
        }
        $clipboard->saveTo($environment);

        if (false === $redirect) {
            return;
        }

        $addToUrlEvent = new AddToUrlEvent('clipboard-item=&original-act=&act=' . $input->getParameter('original-act'));
        $eventDispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $addToUrlEvent);

        $redirectEvent = new RedirectEvent($addToUrlEvent->getUrl());
        $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $redirectEvent);
    }
private function clearClipboard ( ActionEvent $ event , $ redirect = true ) { $ environment = $ event -> getEnvironment ( ) ; $ eventDispatcher = $ environment -> getEventDispatcher ( ) ; $ clipboard = $ environment -> getClipboard ( ) ; $ input = $ environment -> getInputProvider ( ) ; if ( $ clipboardId = $ input -> getParameter ( 'clipboard-item' ) ) { $ clipboard -> removeByClipboardId ( $ clipboardId ) ; } else { $ clipboard -> clear ( ) ; } $ clipboard -> saveTo ( $ environment ) ; if ( false === $ redirect ) { return ; } $ addToUrlEvent = new AddToUrlEvent ( 'clipboard-item=&original-act=&act=' . $ input -> getParameter ( 'original-act' ) ) ; $ eventDispatcher -> dispatch ( ContaoEvents :: BACKEND_ADD_TO_URL , $ addToUrlEvent ) ; $ redirectEvent = new RedirectEvent ( $ addToUrlEvent -> getUrl ( ) ) ; $ eventDispatcher -> dispatch ( ContaoEvents :: CONTROLLER_REDIRECT , $ redirectEvent ) ; }
Handle clear clipboard action.

@param ActionEvent $event    The action event.
@param bool        $redirect Redirect after clear the clipboard.

@return void
Handle clear clipboard action .