How can I use zend-form view helpers?
doing so... How can I use zend-form view helpers?
As a result, the message about the deprecated class contiguration enter image description here
What am I doing wrong?
How can I use zend-form view helpers?
doing so... How can I use zend-form view helpers?
As a result, the message about the deprecated class contiguration enter image description here
What am I doing wrong?
Take a look at this https://github.com/zendframework/zend-expressive/issues/335
Here's how my factory looks like:
public function __invoke(ContainerInterface $container)
{
$config = $container->has('config') ? $container->get('config') : [];
$config = isset($config['view_helpers']) ? $config['view_helpers'] : [];
$manager = new HelperPluginManager($container, $config);
return $manager;
}
Update:
Since I was unclear let's try this again.
As you can see from the post on github, in order to remove the message about deprecated class you need to create a file config/autoload/zend-form.global.php
with the contents:
<?php
use Zend\Form\ConfigProvider;
$provider = new ConfigProvider();
return $provider();
Doing so removes the need to add zend-form view helper configuration to service manager from within the factory that you are creating.
Meaning lines
$formConfig = new FormHelperConfig();
$formConfig->configureServiceManager($manager);
are no longer needed.
Also, method setServiceLocator
of HelperPluginManager
is deprecated so you change these two lines:
$manager = new HelperPluginManager(new Config($config));
$manager->setServiceLocator($container);
to one line:
$manager = new HelperPluginManager($container, $config);
As result your __invoke
function will look like this:
public function __invoke(ContainerInterface $container)
{
$config = $container->has('config') ? $container->get('config') : [];
$config = isset($config['view_helpers']) ? $config['view_helpers'] : [];
$manager = new HelperPluginManager($container, $config);
return $manager;
}
You use view helpers inside your view template. Here you can find the list of all zend-form view helpers together with examples.
I hope this made thing more clear because I suck at explaining things.