TYPO3
7.6
|
Public Member Functions | |
initializeArguments () | |
render () | |
Public Member Functions inherited from AbstractFormFieldViewHelper | |
initializeArguments () | |
getRespectSubmittedDataValue () | |
setRespectSubmittedDataValue ($respectSubmittedDataValue) | |
Protected Attributes | |
$tagName = 'select' | |
$selectedValue = null | |
Protected Attributes inherited from AbstractFormFieldViewHelper | |
$configurationManager | |
$respectSubmittedDataValue = false | |
Protected Attributes inherited from AbstractFormViewHelper | |
$persistenceManager | |
Protected Attributes inherited from AbstractTagBasedViewHelper | |
$tag = null | |
$tagName = 'div' | |
Protected Attributes inherited from AbstractViewHelper | |
$arguments | |
$templateVariableContainer | |
$controllerContext | |
$renderingContext | |
$renderChildrenClosure = null | |
$viewHelperVariableContainer | |
$objectManager | |
$escapingInterceptorEnabled = true | |
Additional Inherited Members | |
Static Public Member Functions inherited from AbstractViewHelper | |
static | renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) |
This view helper generates a <select> dropdown list for the use with a form.
= Basic usage =
The most straightforward way is to supply an associative array as the "options" parameter. The array key is used as option key, and the value is used as human-readable name.
<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card'}" />
= Pre-select a value =
To pre-select a value, set "value" to the option key which should be selected. <f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card'}" value="visa" />
Generates a dropdown box like above, except that "VISA Card" is selected.
If the select box is a multi-select box (multiple="true"), then "value" can be an array as well.
= Usage on domain objects =
If you want to output domain objects, you can just pass them as array into the "options" parameter. To define what domain object value should be used as option key, use the "optionValueField" variable. Same goes for optionLabelField. If neither is given, the Identifier (UID/uid) and the __toString() method are tried as fallbacks.
If the optionValueField variable is set, the getter named after that value is used to retrieve the option key. If the optionLabelField variable is set, the getter named after that value is used to retrieve the option value.
If the prependOptionLabel variable is set, an option item is added in first position, bearing an empty string or - If provided, the value of the prependOptionValue variable as value.
<f:form.select name="users" options="{userArray}" optionValueField="id" optionLabelField="firstName" />
In the above example, the userArray is an array of "User" domain objects, with no array key specified.
So, in the above example, the method $user->getId() is called to retrieve the key, and $user->getFirstName() to retrieve the displayed value of each entry.
The "value" property now expects a domain object, and tests for object equivalence.
Definition at line 58 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
|
protected |
Render the option tags.
Definition at line 155 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References elseif, and AbstractViewHelper\hasArgument().
Referenced by SelectViewHelper\render().
|
protected |
Get the option value for an object
mixed | $valueElement |
Definition at line 252 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References AbstractViewHelper\hasArgument().
Referenced by SelectViewHelper\getSelectedValue().
|
protected |
Retrieves the selected value(s)
Definition at line 232 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References SelectViewHelper\getOptionValueScalar(), AbstractFormFieldViewHelper\getValueAttribute(), and AbstractFormFieldViewHelper\setRespectSubmittedDataValue().
Referenced by SelectViewHelper\isSelected().
initializeArguments | ( | ) |
Initialize arguments.
Definition at line 76 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References AbstractViewHelper\registerArgument(), AbstractTagBasedViewHelper\registerTagAttribute(), and AbstractTagBasedViewHelper\registerUniversalTagAttributes().
|
protected |
Render the option tags.
mixed | $value | Value to check for |
Definition at line 211 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References SelectViewHelper\$selectedValue, elseif, SelectViewHelper\getSelectedValue(), and AbstractViewHelper\hasArgument().
Referenced by SelectViewHelper\renderOptionTags().
render | ( | ) |
Render the tag.
Definition at line 99 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References AbstractFormFieldViewHelper\addAdditionalIdentityPropertiesIfNeeded(), AbstractFormFieldViewHelper\getName(), SelectViewHelper\getOptions(), AbstractViewHelper\hasArgument(), AbstractFormViewHelper\registerFieldNameForFormTokenGeneration(), AbstractFormFieldViewHelper\renderHiddenFieldForEmptyValue(), SelectViewHelper\renderOptionTags(), and AbstractFormFieldViewHelper\setErrorClassAttribute().
|
protected |
Render one option tag
string | $value | value attribute of the option tag (will be escaped) |
string | $label | content of the option tag (will be escaped) |
bool | $isSelected | specifies wheter or not to add selected attribute |
Definition at line 278 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
Referenced by SelectViewHelper\renderOptionTags().
|
protected |
Render the option tags.
array | $options | the options for the form. |
Definition at line 135 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
References AbstractViewHelper\hasArgument(), SelectViewHelper\isSelected(), and SelectViewHelper\renderOptionTag().
Referenced by SelectViewHelper\render().
|
protected |
Definition at line 68 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.
Referenced by SelectViewHelper\isSelected().
|
protected |
Definition at line 63 of file fluid/Classes/ViewHelpers/Form/SelectViewHelper.php.