diff --git a/docs/book/v2/element/captcha.md b/docs/book/v2/element/captcha.md index ee031bdec..13c6ad8d8 100644 --- a/docs/book/v2/element/captcha.md +++ b/docs/book/v2/element/captcha.md @@ -47,8 +47,8 @@ The following methods are specific to the `Captcha` element; all other methods defined by the [parent `Element` class](element.md#public-methods) are also available. -Method signature | Description ----------------------------------------------- | ----------- -`setCaptcha(array|Laminas\Captcha\AdapterInterface $captcha) : void` | Set the CAPTCHA adapter for this element. If `$captcha` is an array, `Laminas\Captcha\Factory::factory()` will be run to create the adapter from the array configuration. -`getCaptcha() : Laminas\Captcha\AdapterInterface` | Return the CAPTCHA adapter for this element. -`getInputSpecification() : array` | Returns a input filter specification, which includes a `Laminas\Filter\StringTrim` filter, and a CAPTCHA validator. +| Method signature | Description | +|-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setCaptcha(array\|Laminas\Captcha\AdapterInterface $captcha) : void` | Set the CAPTCHA adapter for this element. If `$captcha` is an array, `Laminas\Captcha\Factory::factory()` will be run to create the adapter from the array configuration. | +| `getCaptcha() : Laminas\Captcha\AdapterInterface` | Return the CAPTCHA adapter for this element. | +| `getInputSpecification() : array` | Returns a input filter specification, which includes a `Laminas\Filter\StringTrim` filter, and a CAPTCHA validator. | diff --git a/docs/book/v2/element/collection.md b/docs/book/v2/element/collection.md index 1d4507154..6ca7dc945 100644 --- a/docs/book/v2/element/collection.md +++ b/docs/book/v2/element/collection.md @@ -49,25 +49,25 @@ The following methods are specific to the `Collection` element; all other method defined by the [parent `Element` class](element.md#public-methods) are also available. -Method signature | Description -------------------------------------------------------- | ----------- -`setOptions(array $options) : void` | Set options for an element of type Collection. Accepted options, in addition to the options inherited from [Element](element.md#public-methods), are: `target_element`, `count`, `allow_add`, `allow_remove`, `should_create_template` and `template_placeholder`. Those option keys respectively call `setTargetElement()`, `setCount()`, `setAllowAdd()`, `setAllowRemove()`, `setShouldCreateTemplate()` and `setTemplatePlaceholder()`. -`allowObjectBinding(object $object) : bool` | Checks if the object can be set in this fieldset. -`setObject(array|Traversable $object) : void` | Set the object used by the hydrator. In this case the "object" is a collection of objects. -`populateValues(array|Traversable $data) : void` | Populate values -`allowValueBinding() : bool` | Checks if this fieldset can bind data -`setCount($count) : void` | Defines how many times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. -`getCount() : integer` | Return the number of times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. -`setTargetElement($elementOrFieldset) : void` | This function either takes an `Laminas\Form\ElementInterface`, `Laminas\Form\FieldsetInterface` instance or an array to pass to the form factory. When the Collection element will be validated, the input filter will be retrieved from this target element and be used to validate each element in the collection. -`getTargetElement() : ElementInterface|null` | Return the target element used by the collection. -`setAllowAdd($allowAdd) : void` | If allowAdd is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will also be validated and retrieved. -`allowAdd() : boolean` | Return if new elements can be dynamically added in the collection. -`setAllowRemove($allowRemove) : void` | If allowRemove is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will be allowed to be removed. -`allowRemove() : boolean` | Return if new elements can be dynamically removed from the collection. -`setShouldCreateTemplate($shouldCreateTemplate) : void` | If shouldCreateTemplate is set to `true` (defaults to `false`), a `` element will be generated by the `Laminas\Form\View\Helper\FormCollection` view helper. This non-semantic `span` element contains a single data-template HTML5 attribute whose value is the whole HTML to copy to create a new element in the form. The template is indexed using the `templatePlaceholder` value. -`shouldCreateTemplate() : boolean` | Return if a template should be created. -`setTemplatePlaceholder($templatePlaceholder) : void` | Set the template placeholder (defaults to `__index__`) used to index element in the template. -`getTemplatePlaceholder() : string` | Returns the template placeholder used to index element in the template. -`getTemplateElement() : null|ElementInterface|FieldsetInterface` | Get a template element used for rendering purposes only -`prepareElement : void` | Prepare the collection by adding a dummy template element if the user want one -`prepareFieldset() : void` | If both count and targetElement are set, add them to the fieldset +| Method signature | Description | +|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setOptions(array $options) : void` | Set options for an element of type Collection. Accepted options, in addition to the options inherited from [Element](element.md#public-methods), are: `target_element`, `count`, `allow_add`, `allow_remove`, `should_create_template` and `template_placeholder`. Those option keys respectively call `setTargetElement()`, `setCount()`, `setAllowAdd()`, `setAllowRemove()`, `setShouldCreateTemplate()` and `setTemplatePlaceholder()`. | +| `allowObjectBinding(object $object) : bool` | Checks if the object can be set in this fieldset. | +| `setObject(array \| Traversable $object) : void` | Set the object used by the hydrator. In this case the "object" is a collection of objects. | +| `populateValues(array \| Traversable $data) : void` | Populate values | +| `allowValueBinding() : bool` | Checks if this fieldset can bind data | +| `setCount($count) : void` | Defines how many times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. | +| `getCount() : integer` | Return the number of times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. | +| `setTargetElement($elementOrFieldset) : void` | This function either takes an `Laminas\Form\ElementInterface`, `Laminas\Form\FieldsetInterface` instance or an array to pass to the form factory. When the Collection element will be validated, the input filter will be retrieved from this target element and be used to validate each element in the collection. | +| `getTargetElement() : ElementInterface \| null` | Return the target element used by the collection. | +| `setAllowAdd($allowAdd) : void` | If allowAdd is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will also be validated and retrieved. | +| `allowAdd() : boolean` | Return if new elements can be dynamically added in the collection. | +| `setAllowRemove($allowRemove) : void` | If allowRemove is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will be allowed to be removed. | +| `allowRemove() : boolean` | Return if new elements can be dynamically removed from the collection. | +| `setShouldCreateTemplate($shouldCreateTemplate) : void` | If shouldCreateTemplate is set to `true` (defaults to `false`), a `` element will be generated by the `Laminas\Form\View\Helper\FormCollection` view helper. This non-semantic `span` element contains a single data-template HTML5 attribute whose value is the whole HTML to copy to create a new element in the form. The template is indexed using the `templatePlaceholder` value. | +| `shouldCreateTemplate() : boolean` | Return if a template should be created. | +| `setTemplatePlaceholder($templatePlaceholder) : void` | Set the template placeholder (defaults to `__index__`) used to index element in the template. | +| `getTemplatePlaceholder() : string` | Returns the template placeholder used to index element in the template. | +| `getTemplateElement() : null \| ElementInterface \| FieldsetInterface` | Get a template element used for rendering purposes only | +| `prepareElement : void` | Prepare the collection by adding a dummy template element if the user want one | +| `prepareFieldset() : void` | If both count and targetElement are set, add them to the fieldset | diff --git a/docs/book/v2/element/element.md b/docs/book/v2/element/element.md index b804049f1..34045d80e 100644 --- a/docs/book/v2/element/element.md +++ b/docs/book/v2/element/element.md @@ -33,28 +33,28 @@ $form->add($password); ## Public Methods -Method signature | Description ---------------------------------------------------- | ----------- -`setName(string $name) : void` | Set the name for this element. -`getName() : string` | Return the name for this element. -`setValue(string $value) : void` | Set the value for this element. -`getValue() : string` | Return the value for this element. -`setLabel(string $label) : void` | Set the label content for this element. -`getLabel() : string` | Return the label content for this element. -`setLabelAttributes(array $labelAttributes) : void` | Set the attributes to use with the label. -`getLabelAttributes() : array` | Return the attributes to use with the label. -`setLabelOptions(array $labelOptions) : void` | Set label specific options. -`getLabelOptions() : array` | Return the label specific options. -`setOptions(array $options) : void` | Set options for an element. Accepted options are: ``label``, ``label_attributes"``, ``label_options``, which call ``setLabel``, ``setLabelAttributes`` and ``setLabelOptions``, respectively. -`getOptions() : array` | Get defined options for an element -`getOption(string $option) : null|mixed` | Return the specified option, if defined. If it's not defined, returns null. -`setAttribute(string $key, mixed $value) : void` | Set a single element attribute. -`getAttribute(string $key) : mixed` | Retrieve a single element attribute. -`removeAttribute(string $key) : void` | Remove a single attribute -`hasAttribute(string $key) : boolean` | Check if a specific attribute exists for this element. -`setAttributes(array|Traversable $arrayOrTraversable) : void` | Set many attributes at once. Implementation will decide if this will overwrite or merge. -`getAttributes() : array|Traversable` | Retrieve all attributes at once. -`removeAttributes(array $keys) : void` | Remove many attributes at once -`clearAttributes() : void` | Clear all attributes for this element. -`setMessages(array|Traversable $messages) : void` | Set a list of messages to report when validation fails. -`getMessages() : array|Traversable` | Returns a list of validation failure messages, if any. +| Method signature | Description | +|------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setName(string $name) : void` | Set the name for this element. | +| `getName() : string` | Return the name for this element. | +| `setValue(string $value) : void` | Set the value for this element. | +| `getValue() : string` | Return the value for this element. | +| `setLabel(string $label) : void` | Set the label content for this element. | +| `getLabel() : string` | Return the label content for this element. | +| `setLabelAttributes(array $labelAttributes) : void` | Set the attributes to use with the label. | +| `getLabelAttributes() : array` | Return the attributes to use with the label. | +| `setLabelOptions(array $labelOptions) : void` | Set label specific options. | +| `getLabelOptions() : array` | Return the label specific options. | +| `setOptions(array $options) : void` | Set options for an element. Accepted options are: ``label``, ``label_attributes"``, ``label_options``, which call ``setLabel``, ``setLabelAttributes`` and ``setLabelOptions``, respectively. | +| `getOptions() : array` | Get defined options for an element | +| `getOption(string $option) : null \| mixed` | Return the specified option, if defined. If it's not defined, returns null. | +| `setAttribute(string $key, mixed $value) : void` | Set a single element attribute. | +| `getAttribute(string $key) : mixed` | Retrieve a single element attribute. | +| `removeAttribute(string $key) : void` | Remove a single attribute | +| `hasAttribute(string $key) : boolean` | Check if a specific attribute exists for this element. | +| `setAttributes(array \| Traversable $arrayOrTraversable) : void` | Set many attributes at once. Implementation will decide if this will overwrite or merge. | +| `getAttributes() : array \| Traversable` | Retrieve all attributes at once. | +| `removeAttributes(array $keys) : void` | Remove many attributes at once | +| `clearAttributes() : void` | Clear all attributes for this element. | +| `setMessages(array \| Traversable $messages) : void` | Set a list of messages to report when validation fails. | +| `getMessages() : array \| Traversable` | Returns a list of validation failure messages, if any. | diff --git a/docs/book/v2/element/select.md b/docs/book/v2/element/select.md index 0851a304c..54bab5005 100644 --- a/docs/book/v2/element/select.md +++ b/docs/book/v2/element/select.md @@ -129,11 +129,11 @@ The following methods are specific to the `Select` element; all other methods defined by the [parent `Element` class](element.md#public-methods) are also available. -Method signature | Description ----------------------------------------- | ----------- -`setOptions(array $options) : void` | Set options for an element. Accepted options, in addition to the inherited options, include `value_options`, `empty_option`, and `disable_inarray_validator`, which call `setValueOptions()`, `setEmptyOption()` and `setDisableInArrayValidator()`, respectively. -`setValueOptions(array $options) : void` | Set the value options for the select element. The array must contain key/value pairs. -`getValueOptions() : array` | Return the value options. -`unsetValueOption($key) : void` | Unset the value option from the select element. -`setEmptyOption($emptyOption) : void` | Optionally set a label for an empty option (option with no value). It is set to `null` by default, which means that no empty option will be rendered. -`getEmptyOption() : string|null` | Get the label for the empty option (`null` if none). +| Method signature | Description | +|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setOptions(array $options) : void` | Set options for an element. Accepted options, in addition to the inherited options, include `value_options`, `empty_option`, and `disable_inarray_validator`, which call `setValueOptions()`, `setEmptyOption()` and `setDisableInArrayValidator()`, respectively. | +| `setValueOptions(array $options) : void` | Set the value options for the select element. The array must contain key/value pairs. | +| `getValueOptions() : array` | Return the value options. | +| `unsetValueOption($key) : void` | Unset the value option from the select element. | +| `setEmptyOption($emptyOption) : void` | Optionally set a label for an empty option (option with no value). It is set to `null` by default, which means that no empty option will be rendered. | +| `getEmptyOption() : string \| null` | Get the label for the empty option (`null` if none). | diff --git a/docs/book/v2/helper/form-label.md b/docs/book/v2/helper/form-label.md index c54946a76..0d854e52d 100644 --- a/docs/book/v2/helper/form-label.md +++ b/docs/book/v2/helper/form-label.md @@ -65,8 +65,8 @@ See [AbstractHelper Translation](abstract-helper.md#translation). The following public methods are in addition to those inherited from the [AbstractHelper](abstract-helper.md#public-methods): -Method signature | Description ----------------------------------------------------------------------- | ----------- -`__invoke(ElementInterface $element = null, string $labelContent = null, string $position = null) : string` | Render a form label, optionally with content. Always generates a `for` attribute, as we cannot assume the form input will be provided in the `$labelContent`. If the `$labelContent` is `null`, the helper uses the element's label value. `$position` is used to indicate where the label element should be rendered, and should be one of `FormLabel::APPEND` or `FormLabel::PREPEND` (the default). -`openTag(array|ElementInterface $attributesOrElement = null) : string` | Renders the `` closing tag. +| Method signature | Description | +|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `__invoke(ElementInterface $element = null, string $labelContent = null, string $position = null) : string` | Render a form label, optionally with content. Always generates a `for` attribute, as we cannot assume the form input will be provided in the `$labelContent`. If the `$labelContent` is `null`, the helper uses the element's label value. `$position` is used to indicate where the label element should be rendered, and should be one of `FormLabel::APPEND` or `FormLabel::PREPEND` (the default). | +| `openTag(array \| ElementInterface $attributesOrElement = null) : string` | Renders the `` closing tag. | diff --git a/docs/book/v3/element/captcha.md b/docs/book/v3/element/captcha.md index ee031bdec..13c6ad8d8 100644 --- a/docs/book/v3/element/captcha.md +++ b/docs/book/v3/element/captcha.md @@ -47,8 +47,8 @@ The following methods are specific to the `Captcha` element; all other methods defined by the [parent `Element` class](element.md#public-methods) are also available. -Method signature | Description ----------------------------------------------- | ----------- -`setCaptcha(array|Laminas\Captcha\AdapterInterface $captcha) : void` | Set the CAPTCHA adapter for this element. If `$captcha` is an array, `Laminas\Captcha\Factory::factory()` will be run to create the adapter from the array configuration. -`getCaptcha() : Laminas\Captcha\AdapterInterface` | Return the CAPTCHA adapter for this element. -`getInputSpecification() : array` | Returns a input filter specification, which includes a `Laminas\Filter\StringTrim` filter, and a CAPTCHA validator. +| Method signature | Description | +|-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setCaptcha(array\|Laminas\Captcha\AdapterInterface $captcha) : void` | Set the CAPTCHA adapter for this element. If `$captcha` is an array, `Laminas\Captcha\Factory::factory()` will be run to create the adapter from the array configuration. | +| `getCaptcha() : Laminas\Captcha\AdapterInterface` | Return the CAPTCHA adapter for this element. | +| `getInputSpecification() : array` | Returns a input filter specification, which includes a `Laminas\Filter\StringTrim` filter, and a CAPTCHA validator. | diff --git a/docs/book/v3/element/collection.md b/docs/book/v3/element/collection.md index 5e3e8b4ce..95cc285aa 100644 --- a/docs/book/v3/element/collection.md +++ b/docs/book/v3/element/collection.md @@ -49,25 +49,25 @@ The following methods are specific to the `Collection` element; all other method defined by the [parent `Element` class](element.md#public-methods) are also available. -Method signature | Description -------------------------------------------------------- | ----------- -`setOptions(array $options) : void` | Set options for an element of type Collection. Accepted options, in addition to the options inherited from [Element](element.md#public-methods), are: `target_element`, `count`, `allow_add`, `allow_remove`, `should_create_template` and `template_placeholder`. Those option keys respectively call `setTargetElement()`, `setCount()`, `setAllowAdd()`, `setAllowRemove()`, `setShouldCreateTemplate()` and `setTemplatePlaceholder()`. -`allowObjectBinding(object $object) : bool` | Checks if the object can be set in this fieldset. -`setObject(iterable $object) : void` | Set the object used by the hydrator. In this case the "object" is a collection of objects. -`populateValues(iterable $data) : void` | Populate values -`allowValueBinding() : bool` | Checks if this fieldset can bind data -`setCount($count) : void` | Defines how many times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. -`getCount() : integer` | Return the number of times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. -`setTargetElement($elementOrFieldset) : void` | This function either takes an `Laminas\Form\ElementInterface`, `Laminas\Form\FieldsetInterface` instance or an array to pass to the form factory. When the Collection element will be validated, the input filter will be retrieved from this target element and be used to validate each element in the collection. -`getTargetElement() : ElementInterface|null` | Return the target element used by the collection. -`setAllowAdd($allowAdd) : void` | If allowAdd is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will also be validated and retrieved. -`allowAdd() : boolean` | Return if new elements can be dynamically added in the collection. -`setAllowRemove($allowRemove) : void` | If allowRemove is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will be allowed to be removed. -`allowRemove() : boolean` | Return if new elements can be dynamically removed from the collection. -`setShouldCreateTemplate($shouldCreateTemplate) : void` | If shouldCreateTemplate is set to `true` (defaults to `false`), a `` element will be generated by the `Laminas\Form\View\Helper\FormCollection` view helper. This non-semantic `span` element contains a single data-template HTML5 attribute whose value is the whole HTML to copy to create a new element in the form. The template is indexed using the `templatePlaceholder` value. -`shouldCreateTemplate() : boolean` | Return if a template should be created. -`setTemplatePlaceholder($templatePlaceholder) : void` | Set the template placeholder (defaults to `__index__`) used to index element in the template. -`getTemplatePlaceholder() : string` | Returns the template placeholder used to index element in the template. -`getTemplateElement() : null|ElementInterface|FieldsetInterface` | Get a template element used for rendering purposes only -`prepareElement : void` | Prepare the collection by adding a dummy template element if the user want one -`prepareFieldset() : void` | If both count and targetElement are set, add them to the fieldset +| Method signature | Description | +|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setOptions(array $options) : void` | Set options for an element of type Collection. Accepted options, in addition to the options inherited from [Element](element.md#public-methods), are: `target_element`, `count`, `allow_add`, `allow_remove`, `should_create_template` and `template_placeholder`. Those option keys respectively call `setTargetElement()`, `setCount()`, `setAllowAdd()`, `setAllowRemove()`, `setShouldCreateTemplate()` and `setTemplatePlaceholder()`. | +| `allowObjectBinding(object $object) : bool` | Checks if the object can be set in this fieldset. | +| `setObject(iterable $object) : void` | Set the object used by the hydrator. In this case the "object" is a collection of objects. | +| `populateValues(iterable $data) : void` | Populate values | +| `allowValueBinding() : bool` | Checks if this fieldset can bind data | +| `setCount($count) : void` | Defines how many times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. | +| `getCount() : integer` | Return the number of times the target element will be initially rendered by the `Laminas\Form\View\Helper\FormCollection` view helper. | +| `setTargetElement($elementOrFieldset) : void` | This function either takes an `Laminas\Form\ElementInterface`, `Laminas\Form\FieldsetInterface` instance or an array to pass to the form factory. When the Collection element will be validated, the input filter will be retrieved from this target element and be used to validate each element in the collection. | +| `getTargetElement() : ElementInterface \| null` | Return the target element used by the collection. | +| `setAllowAdd($allowAdd) : void` | If allowAdd is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will also be validated and retrieved. | +| `allowAdd() : boolean` | Return if new elements can be dynamically added in the collection. | +| `setAllowRemove($allowRemove) : void` | If allowRemove is set to true (which is the default), new elements added dynamically in the form (using JavaScript, for instance) will be allowed to be removed. | +| `allowRemove() : boolean` | Return if new elements can be dynamically removed from the collection. | +| `setShouldCreateTemplate($shouldCreateTemplate) : void` | If shouldCreateTemplate is set to `true` (defaults to `false`), a `` element will be generated by the `Laminas\Form\View\Helper\FormCollection` view helper. This non-semantic `span` element contains a single data-template HTML5 attribute whose value is the whole HTML to copy to create a new element in the form. The template is indexed using the `templatePlaceholder` value. | +| `shouldCreateTemplate() : boolean` | Return if a template should be created. | +| `setTemplatePlaceholder($templatePlaceholder) : void` | Set the template placeholder (defaults to `__index__`) used to index element in the template. | +| `getTemplatePlaceholder() : string` | Returns the template placeholder used to index element in the template. | +| `getTemplateElement() : null \| ElementInterface \| FieldsetInterface` | Get a template element used for rendering purposes only | +| `prepareElement : void` | Prepare the collection by adding a dummy template element if the user want one | +| `prepareFieldset() : void` | If both count and targetElement are set, add them to the fieldset | diff --git a/docs/book/v3/element/element.md b/docs/book/v3/element/element.md index f6fa01160..d6bf72f85 100644 --- a/docs/book/v3/element/element.md +++ b/docs/book/v3/element/element.md @@ -33,28 +33,28 @@ $form->add($password); ## Public Methods -Method signature | Description ---------------------------------------------------- | ----------- -`setName(string $name) : void` | Set the name for this element. -`getName() : string` | Return the name for this element. -`setValue(string $value) : void` | Set the value for this element. -`getValue() : string` | Return the value for this element. -`setLabel(string $label) : void` | Set the label content for this element. -`getLabel() : string` | Return the label content for this element. -`setLabelAttributes(array $labelAttributes) : void` | Set the attributes to use with the label. -`getLabelAttributes() : array` | Return the attributes to use with the label. -`setLabelOptions(array $labelOptions) : void` | Set label specific options. -`getLabelOptions() : array` | Return the label specific options. -`setOptions(array $options) : void` | Set options for an element. Accepted options are: ``label``, ``label_attributes"``, ``label_options``, which call ``setLabel``, ``setLabelAttributes`` and ``setLabelOptions``, respectively. -`getOptions() : array` | Get defined options for an element -`getOption(string $option) : null|mixed` | Return the specified option, if defined. If it's not defined, returns null. -`setAttribute(string $key, mixed $value) : void` | Set a single element attribute. -`getAttribute(string $key) : mixed` | Retrieve a single element attribute. -`removeAttribute(string $key) : void` | Remove a single attribute -`hasAttribute(string $key) : boolean` | Check if a specific attribute exists for this element. -`setAttributes(iterable $arrayOrTraversable) : void` | Set many attributes at once. Implementation will decide if this will overwrite or merge. -`getAttributes() : iterable` | Retrieve all attributes at once. -`removeAttributes(array $keys) : void` | Remove many attributes at once -`clearAttributes() : void` | Clear all attributes for this element. -`setMessages(iterable $messages) : void` | Set a list of messages to report when validation fails. -`getMessages() : iterable` | Returns a list of validation failure messages, if any. +| Method signature | Description | +|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setName(string $name) : void` | Set the name for this element. | +| `getName() : string` | Return the name for this element. | +| `setValue(string $value) : void` | Set the value for this element. | +| `getValue() : string` | Return the value for this element. | +| `setLabel(string $label) : void` | Set the label content for this element. | +| `getLabel() : string` | Return the label content for this element. | +| `setLabelAttributes(array $labelAttributes) : void` | Set the attributes to use with the label. | +| `getLabelAttributes() : array` | Return the attributes to use with the label. | +| `setLabelOptions(array $labelOptions) : void` | Set label specific options. | +| `getLabelOptions() : array` | Return the label specific options. | +| `setOptions(array $options) : void` | Set options for an element. Accepted options are: ``label``, ``label_attributes"``, ``label_options``, which call ``setLabel``, ``setLabelAttributes`` and ``setLabelOptions``, respectively. | +| `getOptions() : array` | Get defined options for an element | +| `getOption(string $option) : null \| mixed` | Return the specified option, if defined. If it's not defined, returns null. | +| `setAttribute(string $key, mixed $value) : void` | Set a single element attribute. | +| `getAttribute(string $key) : mixed` | Retrieve a single element attribute. | +| `removeAttribute(string $key) : void` | Remove a single attribute | +| `hasAttribute(string $key) : boolean` | Check if a specific attribute exists for this element. | +| `setAttributes(iterable $arrayOrTraversable) : void` | Set many attributes at once. Implementation will decide if this will overwrite or merge. | +| `getAttributes() : iterable` | Retrieve all attributes at once. | +| `removeAttributes(array $keys) : void` | Remove many attributes at once | +| `clearAttributes() : void` | Clear all attributes for this element. | +| `setMessages(iterable $messages) : void` | Set a list of messages to report when validation fails. | +| `getMessages() : iterable` | Returns a list of validation failure messages, if any. | diff --git a/docs/book/v3/element/select.md b/docs/book/v3/element/select.md index 0851a304c..54bab5005 100644 --- a/docs/book/v3/element/select.md +++ b/docs/book/v3/element/select.md @@ -129,11 +129,11 @@ The following methods are specific to the `Select` element; all other methods defined by the [parent `Element` class](element.md#public-methods) are also available. -Method signature | Description ----------------------------------------- | ----------- -`setOptions(array $options) : void` | Set options for an element. Accepted options, in addition to the inherited options, include `value_options`, `empty_option`, and `disable_inarray_validator`, which call `setValueOptions()`, `setEmptyOption()` and `setDisableInArrayValidator()`, respectively. -`setValueOptions(array $options) : void` | Set the value options for the select element. The array must contain key/value pairs. -`getValueOptions() : array` | Return the value options. -`unsetValueOption($key) : void` | Unset the value option from the select element. -`setEmptyOption($emptyOption) : void` | Optionally set a label for an empty option (option with no value). It is set to `null` by default, which means that no empty option will be rendered. -`getEmptyOption() : string|null` | Get the label for the empty option (`null` if none). +| Method signature | Description | +|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `setOptions(array $options) : void` | Set options for an element. Accepted options, in addition to the inherited options, include `value_options`, `empty_option`, and `disable_inarray_validator`, which call `setValueOptions()`, `setEmptyOption()` and `setDisableInArrayValidator()`, respectively. | +| `setValueOptions(array $options) : void` | Set the value options for the select element. The array must contain key/value pairs. | +| `getValueOptions() : array` | Return the value options. | +| `unsetValueOption($key) : void` | Unset the value option from the select element. | +| `setEmptyOption($emptyOption) : void` | Optionally set a label for an empty option (option with no value). It is set to `null` by default, which means that no empty option will be rendered. | +| `getEmptyOption() : string \| null` | Get the label for the empty option (`null` if none). | diff --git a/docs/book/v3/helper/form-label.md b/docs/book/v3/helper/form-label.md index c54946a76..0d854e52d 100644 --- a/docs/book/v3/helper/form-label.md +++ b/docs/book/v3/helper/form-label.md @@ -65,8 +65,8 @@ See [AbstractHelper Translation](abstract-helper.md#translation). The following public methods are in addition to those inherited from the [AbstractHelper](abstract-helper.md#public-methods): -Method signature | Description ----------------------------------------------------------------------- | ----------- -`__invoke(ElementInterface $element = null, string $labelContent = null, string $position = null) : string` | Render a form label, optionally with content. Always generates a `for` attribute, as we cannot assume the form input will be provided in the `$labelContent`. If the `$labelContent` is `null`, the helper uses the element's label value. `$position` is used to indicate where the label element should be rendered, and should be one of `FormLabel::APPEND` or `FormLabel::PREPEND` (the default). -`openTag(array|ElementInterface $attributesOrElement = null) : string` | Renders the `` closing tag. +| Method signature | Description | +|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `__invoke(ElementInterface $element = null, string $labelContent = null, string $position = null) : string` | Render a form label, optionally with content. Always generates a `for` attribute, as we cannot assume the form input will be provided in the `$labelContent`. If the `$labelContent` is `null`, the helper uses the element's label value. `$position` is used to indicate where the label element should be rendered, and should be one of `FormLabel::APPEND` or `FormLabel::PREPEND` (the default). | +| `openTag(array \| ElementInterface $attributesOrElement = null) : string` | Renders the `` closing tag. |