2 namespace TYPO3\CMS\Fluid\ViewHelpers;
123 public function render($action = null, array
$arguments = array(), $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $object = null, $pageType = 0, $noCache =
false, $noCacheHash =
false, $section =
'', $format =
'', array $additionalParams = array(), $absolute =
false, $addQueryString =
false, array $argumentsToBeExcludedFromQueryString = array(), $fieldNamePrefix = null, $actionUri = null, $objectName = null, $hiddenFieldClassName = null)
126 if (strtolower($this->arguments[
'method']) ===
'get') {
127 $this->tag->addAttribute(
'method',
'get');
129 $this->tag->addAttribute(
'method',
'post');
137 if ($this->arguments[
'hiddenFieldClassName'] !== null) {
138 $content = LF .
'<div class="' . htmlspecialchars($this->arguments[
'hiddenFieldClassName']) .
'">';
140 $content = LF .
'<div>';
150 $content .= LF .
'</div>' . LF;
151 $content .= $formContent;
152 $this->tag->setContent($content);
158 return $this->tag->render();
169 $formActionUri = $this->arguments[
'actionUri'];
171 $uriBuilder = $this->controllerContext->getUriBuilder();
172 $formActionUri = $uriBuilder->reset()->setTargetPageUid($this->arguments[
'pageUid'])->setTargetPageType($this->arguments[
'pageType'])->setNoCache($this->arguments[
'noCache'])->setUseCacheHash(!$this->arguments[
'noCacheHash'])->setSection($this->arguments[
'section'])->setCreateAbsoluteUri($this->arguments[
'absolute'])->setArguments((array)$this->arguments[
'additionalParams'])->setAddQueryString($this->arguments[
'addQueryString'])->setArgumentsToBeExcludedFromQueryString((array)$this->arguments[
'argumentsToBeExcludedFromQueryString'])->setFormat($this->arguments[
'format'])->uriFor($this->arguments[
'action'], $this->arguments[
'arguments'], $this->arguments[
'controller'], $this->arguments[
'extensionName'], $this->arguments[
'pluginName']);
173 $this->formActionUriArguments = $uriBuilder->getArguments();
175 $this->tag->addAttribute(
'action', $formActionUri);
186 if ($this->viewHelperVariableContainer->exists(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'additionalIdentityProperties')) {
187 $additionalIdentityProperties = $this->viewHelperVariableContainer->get(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'additionalIdentityProperties');
189 foreach ($additionalIdentityProperties as $identity) {
190 $output .= LF . $identity;
206 $request = $this->controllerContext->getRequest();
207 $extensionName = $request->getControllerExtensionName();
208 $vendorName = $request->getControllerVendorName();
209 $controllerName = $request->getControllerName();
210 $actionName = $request->getControllerActionName();
212 $result .=
'<input type="hidden" name="' . $this->
prefixFieldName(
'__referrer[@extension]') .
'" value="' . $extensionName .
'" />' . LF;
213 if ($vendorName !== null) {
214 $result .=
'<input type="hidden" name="' . $this->
prefixFieldName(
'__referrer[@vendor]') .
'" value="' . $vendorName .
'" />' . LF;
216 $result .=
'<input type="hidden" name="' . $this->
prefixFieldName(
'__referrer[@controller]') .
'" value="' . $controllerName .
'" />' . LF;
217 $result .=
'<input type="hidden" name="' . $this->
prefixFieldName(
'__referrer[@action]') .
'" value="' . $actionName .
'" />' . LF;
218 $result .=
'<input type="hidden" name="' . $this->
prefixFieldName(
'__referrer[arguments]') .
'" value="' . htmlspecialchars($this->hashService->appendHmac(base64_encode(serialize($request->getArguments())))) .
'" />' . LF;
231 if ($formObjectName !== null) {
232 $this->viewHelperVariableContainer->add(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formObjectName', $formObjectName);
244 if ($formObjectName !== null) {
245 $this->viewHelperVariableContainer->remove(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formObjectName');
258 $formObjectName = null;
260 $formObjectName = $this->arguments[
'objectName'];
262 $formObjectName = $this->arguments[
'name'];
264 return $formObjectName;
275 $this->viewHelperVariableContainer->add(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formObject', $this->arguments[
'object']);
276 $this->viewHelperVariableContainer->add(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'additionalIdentityProperties', array());
288 $this->viewHelperVariableContainer->remove(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formObject');
289 $this->viewHelperVariableContainer->remove(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'additionalIdentityProperties');
301 $this->viewHelperVariableContainer->add(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'fieldNamePrefix', $fieldNamePrefix);
312 return $this->arguments[
'fieldNamePrefix'];
325 $this->viewHelperVariableContainer->remove(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'fieldNamePrefix');
335 $this->viewHelperVariableContainer->add(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formFieldNames', array());
345 $this->viewHelperVariableContainer->remove(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formFieldNames');
355 $formFieldNames = $this->viewHelperVariableContainer->get(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formFieldNames');
356 $this->postProcessUriArgumentsForRequesthash($this->formActionUriArguments, $formFieldNames);
357 $requestHash = $this->requestHashService->generateRequestHash($formFieldNames, $this->
getFieldNamePrefix());
359 return '<input type="hidden" name="' . $this->
prefixFieldName(
'__hmac') .
'" value="' . htmlspecialchars($requestHash) .
'" />';
370 foreach (
$arguments as $argumentName => $argumentValue) {
371 if (is_array($argumentValue)) {
372 $prefix = $level == 0 ? $argumentName : $currentPrefix .
'[' . $argumentName .
']';
375 $results[] = $level == 0 ? $argumentName : $currentPrefix .
'[' . $argumentName .
']';
387 $request = $this->controllerContext->getRequest();
389 $extensionName = $this->arguments[
'extensionName'];
391 $extensionName = $request->getControllerExtensionName();
394 $pluginName = $this->arguments[
'pluginName'];
396 $pluginName = $request->getPluginName();
398 if ($extensionName !== null && $pluginName != null) {
399 return $this->extensionService->getPluginNamespace($extensionName, $pluginName);
410 if ($this->viewHelperVariableContainer->exists(\TYPO3\CMS\
Fluid\ViewHelpers\Form\CheckboxViewHelper::class,
'checkboxFieldNames')) {
411 $this->viewHelperVariableContainer->remove(\TYPO3\CMS\
Fluid\ViewHelpers\Form\CheckboxViewHelper::class,
'checkboxFieldNames');
422 $formFieldNames = $this->viewHelperVariableContainer->get(\TYPO3\CMS\
Fluid\ViewHelpers\FormViewHelper::class,
'formFieldNames');
423 $requestHash = $this->mvcPropertyMappingConfigurationService->generateTrustedPropertiesToken($formFieldNames, $this->
getFieldNamePrefix());
424 return '<input type="hidden" name="' . $this->
prefixFieldName(
'__trustedProperties') .
'" value="' . htmlspecialchars($requestHash) .
'" />';