src/Contao/View/Contao2BackendView/ButtonRenderer.php
private function calculateParameters(CommandInterface $command, $serializedModelId)
    {
        $parameters = (array) $command->getParameters();
        if ($command instanceof ToggleCommandInterface) {
            // Toggle has to trigger the javascript.
            $parameters['act'] = $command->getName();
            $parameters['id']  = $serializedModelId;

            return $parameters;
        }
        if (($command instanceof CutCommandInterface) || ($command instanceof CopyCommandInterface)) {
            // Cut & copy need some special information.
            $parameters        = [];
            $parameters['act'] = $command->getName();

            $inputProvider = $this->environment->getInputProvider();
            // If we have a pid add it, used for mode 4 and all parent -> current views.
            if ($inputProvider->hasParameter('pid')) {
                $parameters['pid'] = $inputProvider->getParameter('pid');
            }

            // Source is the id of the element which should move.
            $parameters['source'] = $serializedModelId;

            return $parameters;
        }

        $extra = (array) $command->getExtra();

        $parameters[($extra['idparam'] ?? null) ?: 'id'] = $serializedModelId;

        return $parameters;
    }
private function calculateParameters(CommandInterface $command, $serializedModelId)
    {
        $parameters = (array) $command->getParameters();
        if ($command instanceof ToggleCommandInterface) {
            // Toggle has to trigger the javascript.
            $parameters['act'] = $command->getName();
            $parameters['id']  = $serializedModelId;

            return $parameters;
        }
        if (($command instanceof CutCommandInterface) || ($command instanceof CopyCommandInterface)) {
            // Cut & copy need some special information.
            $parameters        = [];
            $parameters['act'] = $command->getName();

            $inputProvider = $this->environment->getInputProvider();
            // If we have a pid add it, used for mode 4 and all parent -> current views.
            if ($inputProvider->hasParameter('pid')) {
                $parameters['pid'] = $inputProvider->getParameter('pid');
            }

            // Source is the id of the element which should move.
            $parameters['source'] = $serializedModelId;

            return $parameters;
        }

        $extra = (array) $command->getExtra();

        $parameters[($extra['idparam'] ?? null) ?: 'id'] = $serializedModelId;

        return $parameters;
    }
private function calculateParameters ( CommandInterface $ command , $ serializedModelId ) { $ parameters = ( array ) $ command -> getParameters ( ) ; if ( $ command instanceof ToggleCommandInterface ) { // Toggle has to trigger the javascript. $ parameters [ 'act' ] = $ command -> getName ( ) ; $ parameters [ 'id' ] = $ serializedModelId ; return $ parameters ; } if ( ( $ command instanceof CutCommandInterface ) || ( $ command instanceof CopyCommandInterface ) ) { // Cut & copy need some special information. $ parameters = [ ] ; $ parameters [ 'act' ] = $ command -> getName ( ) ; $ inputProvider = $ this -> environment -> getInputProvider ( ) ; // If we have a pid add it, used for mode 4 and all parent -> current views. if ( $ inputProvider -> hasParameter ( 'pid' ) ) { $ parameters [ 'pid' ] = $ inputProvider -> getParameter ( 'pid' ) ; } // Source is the id of the element which should move. $ parameters [ 'source' ] = $ serializedModelId ; return $ parameters ; } $ extra = ( array ) $ command -> getExtra ( ) ; $ parameters [ ( $ extra [ 'idparam' ] ?? null ) ? : 'id' ] = $ serializedModelId ; return $ parameters ; }
Calculate the special parameters for certain operations.

@param CommandInterface $command           The command.
@param string           $serializedModelId The model id to use.

@return string[]
Calculate the special parameters for certain operations .