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

Commit f982970

Browse files
committed
Merge branch 'hotfix/632' into develop
Forward port #632
2 parents 8ef51c8 + 4e5769b commit f982970

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

docs/book/v2/cookbook/using-zend-form-view-helpers.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,36 @@ want to use the various view helpers available in other components, such as:
1010
By default, only the view helpers directly available in zend-view are available;
1111
how can you add the others?
1212

13-
To add the zend-form view helpers create a file `config/autoload/zend-form.global.php`
14-
with the contents:
13+
## ConfigProvider
1514

16-
```php
17-
<?php
18-
use Zend\Form\ConfigProvider;
15+
When you install zend-form, Composer should prompt you if you want to inject one
16+
or more `ConfigProvider` classes, including those from zend-hydrator,
17+
zend-inputfilter, and several others. Always answer "yes" to these; when you do,
18+
a Composer plugin will add entries for their `ConfigProvider` classes to your
19+
`config/config.php` file.
1920

20-
$provider = new ConfigProvider();
21-
return $provider();
22-
```
21+
If for some reason you are not prompted, or chose "no" when answering the
22+
prompts, you can add them manually. Add the following entries in the array used
23+
to create your `ConfigAggregator` instance within `config/config.php`:
2324

24-
and that will essentially do everything needed.
25+
```php
26+
\Zend\Form\ConfigProvider::class,
27+
\Zend\InputFilter\ConfigProvider::class,
28+
\Zend\Filter\ConfigProvider::class,
29+
\Zend\Validator\ConfigProvider::class,
30+
\Zend\Hydrator\ConfigProvider::class,
31+
```
2532

2633
If you installed Expressive via the skeleton, the service
2734
`Zend\View\HelperPluginManager` is registered for you, and represents the helper
28-
plugin manager injected into the `PhpRenderer` instance. As such, you only need
29-
to configure this. The question is: where?
35+
plugin manager injected into the `PhpRenderer` instance. This instance gets its
36+
helper configuration from the `view_helpers` top-level configuration key &mdash;
37+
which the zend-form `ConfigProvider` helps to populate!
38+
39+
At this point, all view helpers provided by zend-form are registered and ready
40+
to use.
3041

31-
You have three options:
42+
Alternative options to configure HelperPluginManager:
3243

3344
- Replace the `HelperPluginManager` factory with your own; or
3445
- Add a delegator factory to or extend the `HelperPluginManager` service to

0 commit comments

Comments
 (0)