src/Security/LogoutForm.php
protected function getFormFields()
    {
        $fields = FieldList::create();

        $controller = $this->getController();
        $backURL = $controller->getBackURL()
            ?: $controller->getReturnReferer();

        // Protect against infinite redirection back to the logout URL after logging out
        if (!$backURL || Director::makeRelative($backURL) === $controller->getRequest()->getURL()) {
            $backURL = Director::baseURL();
        }

        $fields->push(HiddenField::create('BackURL', 'BackURL', $backURL));

        return $fields;
    }
protected function getFormFields()
    {
        $fields = FieldList::create();

        $controller = $this->getController();
        $backURL = $controller->getBackURL()
            ?: $controller->getReturnReferer();

        // Protect against infinite redirection back to the logout URL after logging out
        if (!$backURL || Director::makeRelative($backURL) === $controller->getRequest()->getURL()) {
            $backURL = Director::baseURL();
        }

        $fields->push(HiddenField::create('BackURL', 'BackURL', $backURL));

        return $fields;
    }
protected function getFormFields ( ) { $ fields = FieldList :: create ( ) ; $ controller = $ this -> getController ( ) ; $ backURL = $ controller -> getBackURL ( ) ? : $ controller -> getReturnReferer ( ) ; // Protect against infinite redirection back to the logout URL after logging out if ( ! $ backURL || Director :: makeRelative ( $ backURL ) === $ controller -> getRequest ( ) -> getURL ( ) ) { $ backURL = Director :: baseURL ( ) ; } $ fields -> push ( HiddenField :: create ( 'BackURL' , 'BackURL' , $ backURL ) ) ; return $ fields ; }
Build the FieldList for the logout form

@return FieldList
Build the FieldList for the logout form