src/Contao/View/Contao2BackendView/ButtonRenderer.php
private function renderButtonsFor(
        ModelInterface $model,
        ModelInterface $previous = null,
        ModelInterface $next = null
    ) {
        $modelId = ModelId::fromModel($model)->getSerialized();

        if ($this->clipboardItems) {
            $isCircular = \in_array(ModelId::fromModel($model)->getSerialized(), $this->circularModelIds);
        } else {
            $isCircular = false;
        }
        $childIds = $this->getChildIds($model);

        $buttons = [];
        foreach ($this->commands->getCommands() as $command) {
            $buttons[$command->getName()] =
                $this->buildCommand($command, $model, $previous, $next, $isCircular, $childIds);
        }

        if ($this->hasPasteNewButton()) {
            $buttons['pasteNew'] = $this->renderPasteNewFor($modelId);
        }

        // Add paste into/after icons.
        if ($this->hasPasteButtons()) {
            $urlAfter = $this->addToUrl(\sprintf('act=paste&after=%s&', $modelId));
            $urlInto  = $this->addToUrl(\sprintf('act=paste&into=%s&', $modelId));


            $buttonEvent = new GetPasteButtonEvent($this->environment);
            $buttonEvent
                ->setModel($model)
                ->setCircularReference($isCircular)
                ->setPrevious($previous)
                ->setNext($next)
                ->setHrefAfter($urlAfter)
                ->setHrefInto($urlInto)
                // Check if the id is in the ignore list.
                ->setPasteAfterDisabled($isCircular)
                ->setPasteIntoDisabled($isCircular)
                ->setContainedModels($this->clipboardModels);
            $this->eventDispatcher->dispatch(GetPasteButtonEvent::NAME, $buttonEvent);

            $buttons['pasteafter'] = $this->renderPasteAfterButton($buttonEvent);
            if ($this->isHierarchical()) {
                $buttons['pasteinto'] = $this->renderPasteIntoButton($buttonEvent);
            }
        }

        $model->setMeta(
            $model::OPERATION_BUTTONS,
            \implode(' ', $buttons)
        );
    }
private function renderButtonsFor(
        ModelInterface $model,
        ModelInterface $previous = null,
        ModelInterface $next = null
    ) {
        $modelId = ModelId::fromModel($model)->getSerialized();

        if ($this->clipboardItems) {
            $isCircular = \in_array(ModelId::fromModel($model)->getSerialized(), $this->circularModelIds);
        } else {
            $isCircular = false;
        }
        $childIds = $this->getChildIds($model);

        $buttons = [];
        foreach ($this->commands->getCommands() as $command) {
            $buttons[$command->getName()] =
                $this->buildCommand($command, $model, $previous, $next, $isCircular, $childIds);
        }

        if ($this->hasPasteNewButton()) {
            $buttons['pasteNew'] = $this->renderPasteNewFor($modelId);
        }

        // Add paste into/after icons.
        if ($this->hasPasteButtons()) {
            $urlAfter = $this->addToUrl(\sprintf('act=paste&after=%s&', $modelId));
            $urlInto  = $this->addToUrl(\sprintf('act=paste&into=%s&', $modelId));


            $buttonEvent = new GetPasteButtonEvent($this->environment);
            $buttonEvent
                ->setModel($model)
                ->setCircularReference($isCircular)
                ->setPrevious($previous)
                ->setNext($next)
                ->setHrefAfter($urlAfter)
                ->setHrefInto($urlInto)
                // Check if the id is in the ignore list.
                ->setPasteAfterDisabled($isCircular)
                ->setPasteIntoDisabled($isCircular)
                ->setContainedModels($this->clipboardModels);
            $this->eventDispatcher->dispatch(GetPasteButtonEvent::NAME, $buttonEvent);

            $buttons['pasteafter'] = $this->renderPasteAfterButton($buttonEvent);
            if ($this->isHierarchical()) {
                $buttons['pasteinto'] = $this->renderPasteIntoButton($buttonEvent);
            }
        }

        $model->setMeta(
            $model::OPERATION_BUTTONS,
            \implode(' ', $buttons)
        );
    }
private function renderButtonsFor ( ModelInterface $ model , ModelInterface $ previous = null , ModelInterface $ next = null ) { $ modelId = ModelId :: fromModel ( $ model ) -> getSerialized ( ) ; if ( $ this -> clipboardItems ) { $ isCircular = \ in_array ( ModelId :: fromModel ( $ model ) -> getSerialized ( ) , $ this -> circularModelIds ) ; } else { $ isCircular = false ; } $ childIds = $ this -> getChildIds ( $ model ) ; $ buttons = [ ] ; foreach ( $ this -> commands -> getCommands ( ) as $ command ) { $ buttons [ $ command -> getName ( ) ] = $ this -> buildCommand ( $ command , $ model , $ previous , $ next , $ isCircular , $ childIds ) ; } if ( $ this -> hasPasteNewButton ( ) ) { $ buttons [ 'pasteNew' ] = $ this -> renderPasteNewFor ( $ modelId ) ; } // Add paste into/after icons. if ( $ this -> hasPasteButtons ( ) ) { $ urlAfter = $ this -> addToUrl ( \ sprintf ( 'act=paste&after=%s&' , $ modelId ) ) ; $ urlInto = $ this -> addToUrl ( \ sprintf ( 'act=paste&into=%s&' , $ modelId ) ) ; $ buttonEvent = new GetPasteButtonEvent ( $ this -> environment ) ; $ buttonEvent -> setModel ( $ model ) -> setCircularReference ( $ isCircular ) -> setPrevious ( $ previous ) -> setNext ( $ next ) -> setHrefAfter ( $ urlAfter ) -> setHrefInto ( $ urlInto ) // Check if the id is in the ignore list. -> setPasteAfterDisabled ( $ isCircular ) -> setPasteIntoDisabled ( $ isCircular ) -> setContainedModels ( $ this -> clipboardModels ) ; $ this -> eventDispatcher -> dispatch ( GetPasteButtonEvent :: NAME , $ buttonEvent ) ; $ buttons [ 'pasteafter' ] = $ this -> renderPasteAfterButton ( $ buttonEvent ) ; if ( $ this -> isHierarchical ( ) ) { $ buttons [ 'pasteinto' ] = $ this -> renderPasteIntoButton ( $ buttonEvent ) ; } } $ model -> setMeta ( $ model :: OPERATION_BUTTONS , \ implode ( ' ' , $ buttons ) ) ; }
Render the operation buttons for the passed model.

@param ModelInterface $model    The model to render the buttons for.
@param ModelInterface $previous The previous model in the collection.
@param ModelInterface $next     The next model in the collection.

@return void
Render the operation buttons for the passed model .