private function checkForAction($clipboard, $action)
    {
        // Make a filter for the given action.
        $filter = new Filter();
        $filter->andActionIs($action);
        $items = $clipboard->fetch($filter);

        // Check if there are items.
        if ($items === null) {
            return;
        }

        /** @var ItemInterface[] $items */
        foreach ($items as $item) {
            // Check the context.
            $itemProviderName = $item->getDataProviderName();
            $modelId          = $item->getModelId();

            if ($this->providerName !== $itemProviderName) {
                continue;
            }

            if (!$modelId) {
                $this->checkEmpty($action);
                continue;
            }

            $containedModel = $this->getModelById($modelId->getId());
            if ($this->currentModel == null) {
                $this->checkForRoot($containedModel, $action);
            } elseif ($containedModel) {
                $this->checkForModel($containedModel, $action);
            } else {
                $this->checkEmpty($action);
            }
        }
    }
private function checkForAction($clipboard, $action)
    {
        // Make a filter for the given action.
        $filter = new Filter();
        $filter->andActionIs($action);
        $items = $clipboard->fetch($filter);

        // Check if there are items.
        if ($items === null) {
            return;
        }

        /** @var ItemInterface[] $items */
        foreach ($items as $item) {
            // Check the context.
            $itemProviderName = $item->getDataProviderName();
            $modelId          = $item->getModelId();

            if ($this->providerName !== $itemProviderName) {
                continue;
            }

            if (!$modelId) {
                $this->checkEmpty($action);
                continue;
            }

            $containedModel = $this->getModelById($modelId->getId());
            if ($this->currentModel == null) {
                $this->checkForRoot($containedModel, $action);
            } elseif ($containedModel) {
                $this->checkForModel($containedModel, $action);
            } else {
                $this->checkEmpty($action);
            }
        }
    }
private function checkForAction ( $ clipboard , $ action ) { // Make a filter for the given action. $ filter = new Filter ( ) ; $ filter -> andActionIs ( $ action ) ; $ items = $ clipboard -> fetch ( $ filter ) ; // Check if there are items. if ( $ items === null ) { return ; } /** @var ItemInterface[] $items */ foreach ( $ items as $ item ) { // Check the context. $ itemProviderName = $ item -> getDataProviderName ( ) ; $ modelId = $ item -> getModelId ( ) ; if ( $ this -> providerName !== $ itemProviderName ) { continue ; } if ( ! $ modelId ) { $ this -> checkEmpty ( $ action ) ; continue ; } $ containedModel = $ this -> getModelById ( $ modelId -> getId ( ) ) ; if ( $ this -> currentModel == null ) { $ this -> checkForRoot ( $ containedModel , $ action ) ; } elseif ( $ containedModel ) { $ this -> checkForModel ( $ containedModel , $ action ) ; } else { $ this -> checkEmpty ( $ action ) ; } } }
Check the buttons based on the action.

@param ClipboardInterface $clipboard The clipboard.

@param string             $action    The action to be checked.

@return void
Check the buttons based on the action .