Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 56e3a84

Browse files
committed
Merge branch 'hotfix/34'
Close #34
2 parents 369803e + 95836fa commit 56e3a84

File tree

5 files changed

+61
-61
lines changed

5 files changed

+61
-61
lines changed

book/zend.form.collections.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,15 @@ entity.
420420
This element has a few interesting options:
421421

422422
- `count`: this is how many times the element (in this case a category) has to be rendered. We've
423-
set it to two in this examples.
423+
set it to two in this examples.
424424
- `should_create_template`: if set to `true`, it will generate a template markup in a `<span>`
425-
element, in order to simplify adding new element on the fly (we will speak about this one later).
425+
element, in order to simplify adding new element on the fly (we will speak about this one later).
426426
- `allow_add`: if set to `true` (which is the default), dynamically added elements will be retrieved
427-
and validated; otherwise, they will be completely ignored. This, of course, depends on what you want
428-
to do.
427+
and validated; otherwise, they will be completely ignored. This, of course, depends on what you want
428+
to do.
429429
- `target_element`: this is either an element or, as this is the case in this example, an array that
430-
describes the element or fieldset that will be used in the collection. In this case, the
431-
`target_element` is a `Category` fieldset.
430+
describes the element or fieldset that will be used in the collection. In this case, the
431+
`target_element` is a `Category` fieldset.
432432

433433
## The Form Element
434434

@@ -551,13 +551,13 @@ echo $this->form()->closeTag();
551551
A few new things here :
552552

553553
- the `prepare()` method. You *must* call it prior to rendering anything in the view (this function
554-
is only meant to be called in views, not in controllers).
554+
is only meant to be called in views, not in controllers).
555555
- the `FormRow` helper renders a label (if present), the input itself, and errors.
556556
- the `FormCollection` helper will iterate through every element in the collection, and render every
557-
element with the FormRow helper (you may specify an alternate helper if desired, using the
558-
`setElementHelper()` method on that `FormCollection` helper instance). If you need more control
559-
about the way you render your forms, you can iterate through the elements in the collection, and
560-
render them manually one by one.
557+
element with the FormRow helper (you may specify an alternate helper if desired, using the
558+
`setElementHelper()` method on that `FormCollection` helper instance). If you need more control
559+
about the way you render your forms, you can iterate through the elements in the collection, and
560+
render them manually one by one.
561561

562562
Here is the result:
563563

@@ -629,7 +629,7 @@ The `add_category` function is fairly simple:
629629

630630
Here is the code:
631631

632-
```php
632+
```javascript
633633
<script>
634634
function add_category() {
635635
var currentCount = $('form > fieldset > fieldset').length;
@@ -679,13 +679,13 @@ $this->add(array(
679679
There are some limitations to this capability:
680680

681681
- Although you can add new elements and remove them, you *CANNOT* remove more elements in a
682-
collection than the initial count (for instance, if your code specifies `count == 2`, you will be
683-
able to add a third one and remove it, but you won't be able to remove any others. If the initial
684-
count is 2, you *must* have at least two elements.
682+
collection than the initial count (for instance, if your code specifies `count == 2`, you will be
683+
able to add a third one and remove it, but you won't be able to remove any others. If the initial
684+
count is 2, you *must* have at least two elements.
685685
- Dynamically added elements have to be added at the end of the collection. They can be added
686-
anywhere (these elements will still be validated and inserted into the entity), but if the
687-
validation fails, this newly added element will be automatically be replaced at the end of the
688-
collection.
686+
anywhere (these elements will still be validated and inserted into the entity), but if the
687+
validation fails, this newly added element will be automatically be replaced at the end of the
688+
collection.
689689

690690
## Validation groups for fieldsets and collection
691691

book/zend.form.elements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ string. The following keys are supported:
481481
- `"selected"` - Boolean that sets whether the option is marked as selected.
482482
- `"disabled"` - Boolean that sets whether the option will be disabled
483483
- `"attributes"` - Array of html attributes that will be set on this option. Merged with the
484-
attributes set on the element.
484+
attributes set on the element.
485485
- `"label_attributes"` - Array of html attributes that will be set on the label. Merged with the
486-
attributes set on the element's label.
486+
attributes set on the element's label.
487487

488488
```php
489489
$form = new Form('my-form');

book/zend.form.file-upload.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ class UploadForm extends Form
5959
The `File` element provides some automatic features that happen behind the scenes:
6060

6161
- The form's `enctype` will automatically be set to `multipart/form-data` when the form `prepare()`
62-
method is called.
62+
method is called.
6363
- The file element's default input specification will create the correct `Input` type:
64-
\[Zend\\InputFilter\\FileInput\](zend.input-filter.file-input).
64+
\[Zend\\InputFilter\\FileInput\](zend.input-filter.file-input).
6565
- The `FileInput` will automatically prepend an \[UploadFile
66-
Validator\](zend.validator.file.upload-file), to securely validate that the file is actually an
67-
uploaded file, and to report other types of upload errors to the user.
66+
Validator\](zend.validator.file.upload-file), to securely validate that the file is actually an
67+
uploaded file, and to report other types of upload errors to the user.
6868

6969
### The View Template
7070

@@ -297,10 +297,10 @@ information on its supported options.
297297
Behind the scenes, the `FilePRG` plugin will:
298298

299299
- Run the Form's filters, namely the `RenameUpload` filter, to move the files out of temporary
300-
storage.
300+
storage.
301301
- Store the valid POST data in the session across requests.
302302
- Change the `required` flag of any file inputs that had valid uploads to `false`. This is so that
303-
form re-submissions without uploads will not cause validation errors.
303+
form re-submissions without uploads will not cause validation errors.
304304

305305
> ## Note
306306
In the case of a partially valid form, it is up to the developer whether to notify the user that
@@ -656,5 +656,5 @@ Related documentation:
656656
External resources and blog posts from the community:
657657

658658
- [ZF2FileUploadExamples](https://github.com/cgmartin/ZF2FileUploadExamples) : A ZF2 module with
659-
several file upload examples.
659+
several file upload examples.
660660

book/zend.form.intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The `Zend\Form` component consists of the following objects:
99
- `Elements`, which simply consist of a name and attributes.
1010
- `Fieldsets`, which extend from `Elements`, but allow composing other fieldsets and elements.
1111
- `Forms`, which extend from `Fieldsets` (and thus `Elements`). They provide data and object
12-
binding, and compose \[InputFilters\](zend.input-filter.intro). Data binding is done via
13-
\[Zend\\Stdlib\\Hydrator\](zend.stdlib.hydrator).
12+
binding, and compose \[InputFilters\](zend.input-filter.intro). Data binding is done via
13+
\[Zend\\Stdlib\\Hydrator\](zend.stdlib.hydrator).
1414

1515
To facilitate usage with the view layer, the `Zend\Form` component also aggregates a number of
1616
form-specific view helpers. These accept elements, fieldsets, and/or forms, and use the attributes

book/zend.form.quick-start.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ class SenderFieldset extends Fieldset implements InputFilterProviderInterface
519519
),
520520
'validators' => array(
521521
array(
522-
'name' => 'Zend\Validator\StringLength',
522+
'name' => 'Zend\Validator\StringLength',
523523
'options' => array(
524524
'min' => 3,
525525
'max' => 256
@@ -561,15 +561,15 @@ that in action.
561561
When you `bind()` an object to the form, the following happens:
562562

563563
- The composed `Hydrator` calls `extract()` on the object, and uses the values returned, if any, to
564-
populate the `value` attributes of all elements. If a form contains a fieldset that itself contains
565-
another fieldset, the form will recursively extract the values.
564+
populate the `value` attributes of all elements. If a form contains a fieldset that itself contains
565+
another fieldset, the form will recursively extract the values.
566566
- When `isValid()` is called, if `setData()` has not been previously set, the form uses the composed
567-
`Hydrator` to extract values from the object, and uses those during validation.
567+
`Hydrator` to extract values from the object, and uses those during validation.
568568
- If `isValid()` is successful (and the `bindOnValidate` flag is enabled, which is true by default),
569-
then the `Hydrator` will be passed the validated values to use to hydrate the bound object. (If you
570-
do not want this behavior, call `setBindOnValidate(FormInterface::BIND_MANUAL)`).
569+
then the `Hydrator` will be passed the validated values to use to hydrate the bound object. (If you
570+
do not want this behavior, call `setBindOnValidate(FormInterface::BIND_MANUAL)`).
571571
- If the object implements `Zend\InputFilter\InputFilterAwareInterface`, the input filter it
572-
composes will be used instead of the one composed on the form.
572+
composes will be used instead of the one composed on the form.
573573

574574
This is easier to understand in practice.
575575

@@ -858,46 +858,46 @@ annotations in `Zend\Form`:
858858

859859
- *AllowEmpty*: mark an input as allowing an empty value. This annotation does not require a value.
860860
- *Attributes*: specify the form, fieldset, or element attributes. This annotation requires an
861-
associative array of values, in a JSON object format:
862-
`@Attributes({"class":"zend_form","type":"text"})`.
861+
associative array of values, in a JSON object format:
862+
`@Attributes({"class":"zend_form","type":"text"})`.
863863
- *ComposedObject*: specify another object with annotations to parse. Typically, this is used if a
864-
property references another object, which will then be added to your form as an additional fieldset.
865-
Expects a string value indicating the class for the object being composed
866-
`@ComposedObject("Namespace\Model\ComposedObject")` or an array to compose a collection:
867-
`@ComposedObject({ "target_object":"Namespace\Model\ComposedCollection", "is_collection":"true",
868-
"options":{"count":2}})` `target_object` is the element to compose, `is_collection` flags this as a
869-
collection and `options` can take an array of options to pass into the collection.
864+
property references another object, which will then be added to your form as an additional fieldset.
865+
Expects a string value indicating the class for the object being composed
866+
`@ComposedObject("Namespace\Model\ComposedObject")` or an array to compose a collection:
867+
`@ComposedObject({ "target_object":"Namespace\Model\ComposedCollection", "is_collection":"true",
868+
"options":{"count":2}})` `target_object` is the element to compose, `is_collection` flags this as a
869+
collection and `options` can take an array of options to pass into the collection.
870870
- *ErrorMessage*: specify the error message to return for an element in the case of a failed
871-
validation. Expects a string value.
871+
validation. Expects a string value.
872872
- *Exclude*: mark a property to exclude from the form or fieldset. This annotation does not require
873-
a value.
873+
a value.
874874
- *Filter*: provide a specification for a filter to use on a given element. Expects an associative
875-
array of values, with a "name" key pointing to a string filter name, and an "options" key pointing
876-
to an associative array of filter options for the constructor: `@Filter({"name": "Boolean",
877-
"options": {"casting":true}})`. This annotation may be specified multiple times.
875+
array of values, with a "name" key pointing to a string filter name, and an "options" key pointing
876+
to an associative array of filter options for the constructor: `@Filter({"name": "Boolean",
877+
"options": {"casting":true}})`. This annotation may be specified multiple times.
878878
- *Flags*: flags to pass to the fieldset or form composing an element or fieldset; these are usually
879-
used to specify the name or priority. The annotation expects an associative array:
880-
`@Flags({"priority": 100})`.
879+
used to specify the name or priority. The annotation expects an associative array:
880+
`@Flags({"priority": 100})`.
881881
- *Hydrator*: specify the hydrator class to use for this given form or fieldset. A string value is
882-
expected.
882+
expected.
883883
- *InputFilter*: specify the input filter class to use for this given form or fieldset. A string
884-
value is expected.
884+
value is expected.
885885
- *Input*: specify the input class to use for this given element. A string value is expected.
886886
- *Instance*: specify an object class instance to bind to the form or fieldset.
887887
- *Name*: specify the name of the current element, fieldset, or form. A string value is expected.
888888
- *Object*: specify an object class instance to bind to the form or fieldset. (Note: this is
889-
deprecated in 2.4.0; use *Instance* instead.)
889+
deprecated in 2.4.0; use *Instance* instead.)
890890
- *Options*: options to pass to the fieldset or form that are used to inform behavior -- things that
891-
are not attributes; e.g. labels, CAPTCHA adapters, etc. The annotation expects an associative array:
892-
`@Options({"label": "Username:"})`.
891+
are not attributes; e.g. labels, CAPTCHA adapters, etc. The annotation expects an associative array:
892+
`@Options({"label": "Username:"})`.
893893
- *Required*: indicate whether an element is required. A boolean value is expected. By default, all
894-
elements are required, so this annotation is mainly present to allow disabling a requirement.
894+
elements are required, so this annotation is mainly present to allow disabling a requirement.
895895
- *Type*: indicate the class to use for the current element, fieldset, or form. A string value is
896-
expected.
896+
expected.
897897
- *Validator*: provide a specification for a validator to use on a given element. Expects an
898-
associative array of values, with a "name" key pointing to a string validator name, and an "options"
899-
key pointing to an associative array of validator options for the constructor: `@Validator({"name":
900-
"StringLength", "options": {"min":3, "max": 25}})`. This annotation may be specified multiple times.
898+
associative array of values, with a "name" key pointing to a string validator name, and an "options"
899+
key pointing to an associative array of validator options for the constructor: `@Validator({"name":
900+
"StringLength", "options": {"min":3, "max": 25}})`. This annotation may be specified multiple times.
901901

902902
To use annotations, you simply include them in your class and/or property docblocks. Annotation
903903
names will be resolved according to the import statements in your class; as such, you can make them

0 commit comments

Comments
 (0)