src/Contao/View/Contao2BackendView/EditMask.php
protected function handleSubmit(ModelInterface $model)
    {
        $environment   = $this->getEnvironment();
        $dispatcher    = $environment->getEventDispatcher();
        $inputProvider = $environment->getInputProvider();

        if ($inputProvider->hasValue('save')) {
            $newUrlEvent = new AddToUrlEvent('act=edit&id=' . ModelId::fromModel($model)->getSerialized());
            $dispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getUrl()));
        } elseif ($inputProvider->hasValue('saveNclose')) {
            $this->clearBackendStates();

            $newUrlEvent = new GetReferrerEvent();
            $dispatcher->dispatch(ContaoEvents::SYSTEM_GET_REFERRER, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getReferrerUrl()));
        } elseif ($inputProvider->hasValue('saveNcreate')) {
            $this->clearBackendStates();
            $after = ModelId::fromModel($model);

            $newUrlEvent = new AddToUrlEvent('act=create&id=&after=' . $after->getSerialized());
            $dispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getUrl()));
        } elseif ($inputProvider->hasValue('saveNback')) {
            $this->clearBackendStates();

            $parentProviderName = $environment->getDataDefinition()->getBasicDefinition()->getParentDataProvider();
            $newUrlEvent        = new GetReferrerEvent(false, $parentProviderName);

            $dispatcher->dispatch(ContaoEvents::SYSTEM_GET_REFERRER, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getReferrerUrl()));
        }
    }
protected function handleSubmit(ModelInterface $model)
    {
        $environment   = $this->getEnvironment();
        $dispatcher    = $environment->getEventDispatcher();
        $inputProvider = $environment->getInputProvider();

        if ($inputProvider->hasValue('save')) {
            $newUrlEvent = new AddToUrlEvent('act=edit&id=' . ModelId::fromModel($model)->getSerialized());
            $dispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getUrl()));
        } elseif ($inputProvider->hasValue('saveNclose')) {
            $this->clearBackendStates();

            $newUrlEvent = new GetReferrerEvent();
            $dispatcher->dispatch(ContaoEvents::SYSTEM_GET_REFERRER, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getReferrerUrl()));
        } elseif ($inputProvider->hasValue('saveNcreate')) {
            $this->clearBackendStates();
            $after = ModelId::fromModel($model);

            $newUrlEvent = new AddToUrlEvent('act=create&id=&after=' . $after->getSerialized());
            $dispatcher->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getUrl()));
        } elseif ($inputProvider->hasValue('saveNback')) {
            $this->clearBackendStates();

            $parentProviderName = $environment->getDataDefinition()->getBasicDefinition()->getParentDataProvider();
            $newUrlEvent        = new GetReferrerEvent(false, $parentProviderName);

            $dispatcher->dispatch(ContaoEvents::SYSTEM_GET_REFERRER, $newUrlEvent);
            $dispatcher->dispatch(ContaoEvents::CONTROLLER_REDIRECT, new RedirectEvent($newUrlEvent->getReferrerUrl()));
        }
    }
protected function handleSubmit ( ModelInterface $ model ) { $ environment = $ this -> getEnvironment ( ) ; $ dispatcher = $ environment -> getEventDispatcher ( ) ; $ inputProvider = $ environment -> getInputProvider ( ) ; if ( $ inputProvider -> hasValue ( 'save' ) ) { $ newUrlEvent = new AddToUrlEvent ( 'act=edit&id=' . ModelId :: fromModel ( $ model ) -> getSerialized ( ) ) ; $ dispatcher -> dispatch ( ContaoEvents :: BACKEND_ADD_TO_URL , $ newUrlEvent ) ; $ dispatcher -> dispatch ( ContaoEvents :: CONTROLLER_REDIRECT , new RedirectEvent ( $ newUrlEvent -> getUrl ( ) ) ) ; } elseif ( $ inputProvider -> hasValue ( 'saveNclose' ) ) { $ this -> clearBackendStates ( ) ; $ newUrlEvent = new GetReferrerEvent ( ) ; $ dispatcher -> dispatch ( ContaoEvents :: SYSTEM_GET_REFERRER , $ newUrlEvent ) ; $ dispatcher -> dispatch ( ContaoEvents :: CONTROLLER_REDIRECT , new RedirectEvent ( $ newUrlEvent -> getReferrerUrl ( ) ) ) ; } elseif ( $ inputProvider -> hasValue ( 'saveNcreate' ) ) { $ this -> clearBackendStates ( ) ; $ after = ModelId :: fromModel ( $ model ) ; $ newUrlEvent = new AddToUrlEvent ( 'act=create&id=&after=' . $ after -> getSerialized ( ) ) ; $ dispatcher -> dispatch ( ContaoEvents :: BACKEND_ADD_TO_URL , $ newUrlEvent ) ; $ dispatcher -> dispatch ( ContaoEvents :: CONTROLLER_REDIRECT , new RedirectEvent ( $ newUrlEvent -> getUrl ( ) ) ) ; } elseif ( $ inputProvider -> hasValue ( 'saveNback' ) ) { $ this -> clearBackendStates ( ) ; $ parentProviderName = $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) -> getParentDataProvider ( ) ; $ newUrlEvent = new GetReferrerEvent ( false , $ parentProviderName ) ; $ dispatcher -> dispatch ( ContaoEvents :: SYSTEM_GET_REFERRER , $ newUrlEvent ) ; $ dispatcher -> dispatch ( ContaoEvents :: CONTROLLER_REDIRECT , new RedirectEvent ( $ newUrlEvent -> getReferrerUrl ( ) ) ) ; } }
Handle the submit and determine which button has been triggered.

This method will redirect the client.

@param ModelInterface $model The model that has been submitted.

@return void

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
Handle the submit and determine which button has been triggered .