public render ( string $action = null, array $arguments = [], string $controller = null, string $package = null, string $subpackage = null, mixed $object = null, string $section = '', string $format = '', array $additionalParams = [], boolean $absolute = false, boolean $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], string $fieldNamePrefix = null, string $actionUri = null, string $objectName = null, boolean $useParentRequest = false ) : string | ||
$action | string | target action |
$arguments | array | additional arguments |
$controller | string | name of target controller |
$package | string | name of target package |
$subpackage | string | name of target subpackage |
$object | mixed | object to use for the form. Use in conjunction with the "property" attribute on the sub tags |
$section | string | The anchor to be added to the action URI (only active if $actionUri is not set) |
$format | string | The requested format (e.g. ".html") of the target page (only active if $actionUri is not set) |
$additionalParams | array | additional action URI query parameters that won't be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set) |
$absolute | boolean | If set, an absolute action URI is rendered (only active if $actionUri is not set) |
$addQueryString | boolean | If set, the current query parameters will be kept in the action URI (only active if $actionUri is not set) |
$argumentsToBeExcludedFromQueryString | array | arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set |
$fieldNamePrefix | string | Prefix that will be added to all field names within this form |
$actionUri | string | can be used to overwrite the "action" attribute of the form tag |
$objectName | string | name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName |
$useParentRequest | boolean | If set, the parent Request will be used instead ob the current one |
return | string | rendered form |
public function render($action = null, array $arguments = array(), $controller = null, $package = null, $subpackage = null, $object = null, $section = '', $format = '', array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array(), $fieldNamePrefix = null, $actionUri = null, $objectName = null, $useParentRequest = false)
{
$this->formActionUri = null;
if ($action === null && $actionUri === null) {
throw new ViewHelper\Exception('FormViewHelper requires "actionUri" or "action" argument to be specified', 1355243748);
}
$this->tag->addAttribute('action', $this->getFormActionUri());
if (strtolower($this->arguments['method']) === 'get') {
$this->tag->addAttribute('method', 'get');
} else {
$this->tag->addAttribute('method', 'post');
}
$this->addFormObjectNameToViewHelperVariableContainer();
$this->addFormObjectToViewHelperVariableContainer();
$this->addFieldNamePrefixToViewHelperVariableContainer();
$this->addFormFieldNamesToViewHelperVariableContainer();
$this->addEmptyHiddenFieldNamesToViewHelperVariableContainer();
$formContent = $this->renderChildren();
// wrap hidden field in div container in order to create XHTML valid output
$content = chr(10) . '<div style="display: none">';
if (strtolower($this->arguments['method']) === 'get') {
$content .= $this->renderHiddenActionUriQueryParameters();
}
$content .= $this->renderHiddenIdentityField($this->arguments['object'], $this->getFormObjectName());
$content .= $this->renderAdditionalIdentityFields();
$content .= $this->renderHiddenReferrerFields();
$content .= $this->renderEmptyHiddenFields();
// Render the trusted list of all properties after everything else has been rendered
$content .= $this->renderTrustedPropertiesField();
$content .= $this->renderCsrfTokenField();
$content .= '</div>' . chr(10);
$content .= $formContent;
$this->tag->setContent($content);
$this->removeFieldNamePrefixFromViewHelperVariableContainer();
$this->removeFormObjectFromViewHelperVariableContainer();
$this->removeFormObjectNameFromViewHelperVariableContainer();
$this->removeFormFieldNamesFromViewHelperVariableContainer();
$this->removeEmptyHiddenFieldNamesFromViewHelperVariableContainer();
return $this->tag->render();
}