src/Contao/View/Contao2BackendView/Subscriber/CheckPermission.php
private function disableCommandByActionName(CommandCollectionInterface $commands, $actionName)
    {
        foreach ($commands->getCommands() as $command) {
            $parameters = $command->getParameters()->getArrayCopy();

            $disableCommand = false;

            if (\array_key_exists('act', $parameters)
                && ($parameters['act'] === $actionName)
            ) {
                $disableCommand = true;
            }

            if (!$disableCommand && ($command->getName() === $actionName)) {
                $disableCommand = true;
            }

            if (!$disableCommand) {
                continue;
            }

            $command->setDisabled();
        }
    }
private function disableCommandByActionName(CommandCollectionInterface $commands, $actionName)
    {
        foreach ($commands->getCommands() as $command) {
            $parameters = $command->getParameters()->getArrayCopy();

            $disableCommand = false;

            if (\array_key_exists('act', $parameters)
                && ($parameters['act'] === $actionName)
            ) {
                $disableCommand = true;
            }

            if (!$disableCommand && ($command->getName() === $actionName)) {
                $disableCommand = true;
            }

            if (!$disableCommand) {
                continue;
            }

            $command->setDisabled();
        }
    }
private function disableCommandByActionName ( CommandCollectionInterface $ commands , $ actionName ) { foreach ( $ commands -> getCommands ( ) as $ command ) { $ parameters = $ command -> getParameters ( ) -> getArrayCopy ( ) ; $ disableCommand = false ; if ( \ array_key_exists ( 'act' , $ parameters ) && ( $ parameters [ 'act' ] === $ actionName ) ) { $ disableCommand = true ; } if ( ! $ disableCommand && ( $ command -> getName ( ) === $ actionName ) ) { $ disableCommand = true ; } if ( ! $ disableCommand ) { continue ; } $ command -> setDisabled ( ) ; } }
Disable command by action name.

@param CommandCollectionInterface $commands   The commands collection.
@param string                     $actionName The action name.

@return void
Disable command by action name .