Neos\FluidAdaptor\ViewHelpers\FormViewHelper::renderHiddenReferrerFields PHP Method

renderHiddenReferrerFields() protected method

Renders hidden form fields for referrer information about the current controller and action.
protected renderHiddenReferrerFields ( ) : string
return string Hidden fields with referrer information
    protected function renderHiddenReferrerFields()
    {
        $result = chr(10);
        $request = $this->controllerContext->getRequest();
        $argumentNamespace = null;
        if (!$request->isMainRequest()) {
            $argumentNamespace = $request->getArgumentNamespace();
            $referrer = array('@package' => $request->getControllerPackageKey(), '@subpackage' => $request->getControllerSubpackageKey(), '@controller' => $request->getControllerName(), '@action' => $request->getControllerActionName(), 'arguments' => $this->hashService->appendHmac(base64_encode(serialize($request->getArguments()))));
            foreach ($referrer as $referrerKey => $referrerValue) {
                $referrerValue = htmlspecialchars($referrerValue);
                $result .= '<input type="hidden" name="' . $argumentNamespace . '[__referrer][' . $referrerKey . ']" value="' . $referrerValue . '" />' . chr(10);
            }
            $request = $request->getParentRequest();
        }
        $arguments = $request->getArguments();
        if ($argumentNamespace !== null && isset($arguments[$argumentNamespace])) {
            // A sub request was there; thus we can unset the sub requests arguments,
            // as they are transferred separately via the code block shown above.
            unset($arguments[$argumentNamespace]);
        }
        $referrer = array('@package' => $request->getControllerPackageKey(), '@subpackage' => $request->getControllerSubpackageKey(), '@controller' => $request->getControllerName(), '@action' => $request->getControllerActionName(), 'arguments' => $this->hashService->appendHmac(base64_encode(serialize($arguments))));
        foreach ($referrer as $referrerKey => $referrerValue) {
            $result .= '<input type="hidden" name="__referrer[' . $referrerKey . ']" value="' . htmlspecialchars($referrerValue) . '" />' . chr(10);
        }
        return $result;
    }