src/Contao/View/Contao2BackendView/ActionHandler/SelectHandler.php
private function clearClipboard(EnvironmentInterface $environment)
    {
        $basicDefinition = $environment->getDataDefinition()->getBasicDefinition();

        $filter = new Filter();
        $filter->andModelIsFromProvider($basicDefinition->getDataProvider());
        if ($basicDefinition->getParentDataProvider()) {
            $filter->andParentIsFromProvider($basicDefinition->getParentDataProvider());
        } else {
            $filter->andHasNoParent();
        }

        $clipboard = $environment->getClipboard();

        $items = $clipboard->fetch($filter);
        if (\count($items) < 1) {
            return;
        }

        foreach ($items as $item) {
            $clipboard->remove($item);
        }
    }
private function clearClipboard(EnvironmentInterface $environment)
    {
        $basicDefinition = $environment->getDataDefinition()->getBasicDefinition();

        $filter = new Filter();
        $filter->andModelIsFromProvider($basicDefinition->getDataProvider());
        if ($basicDefinition->getParentDataProvider()) {
            $filter->andParentIsFromProvider($basicDefinition->getParentDataProvider());
        } else {
            $filter->andHasNoParent();
        }

        $clipboard = $environment->getClipboard();

        $items = $clipboard->fetch($filter);
        if (\count($items) < 1) {
            return;
        }

        foreach ($items as $item) {
            $clipboard->remove($item);
        }
    }
private function clearClipboard ( EnvironmentInterface $ environment ) { $ basicDefinition = $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) ; $ filter = new Filter ( ) ; $ filter -> andModelIsFromProvider ( $ basicDefinition -> getDataProvider ( ) ) ; if ( $ basicDefinition -> getParentDataProvider ( ) ) { $ filter -> andParentIsFromProvider ( $ basicDefinition -> getParentDataProvider ( ) ) ; } else { $ filter -> andHasNoParent ( ) ; } $ clipboard = $ environment -> getClipboard ( ) ; $ items = $ clipboard -> fetch ( $ filter ) ; if ( \ count ( $ items ) < 1 ) { return ; } foreach ( $ items as $ item ) { $ clipboard -> remove ( $ item ) ; } }
Clear the clipboard if has items.

@param EnvironmentInterface $environment The environment.

@return void
Clear the clipboard if has items .