The form view helpers are all located in the Zend\Form\View\Helper
namespace. There is a separate config where all form view helpers are injected in the view helper plugin manager.
Usually this happens automatically. At least, when you require "zendframework/zendframework"
and not all individual components this works out of the box. In the Zend\Mvc
namespace there is a special factory which helps to instantiate the view helper's plugin manager. It also tries to inject view helpers from other components: the navigation
, i18n
and form
view helpers.
That being said, there are either two options where this went wrong for you:
The factory does a
class_exists()
call on those additional view helper configs. If the classZend\Form\View\HelperConfig
cannot be found due to autoloading issues, the form view helpers are not initialized.The factory is not even called. If you use
Zend\Mvc\Application
this can be a bug and please provide some more info about your case so others can reproduce it. If you do not use the Application, you have to wire these kind of things manually.
In the case of the latter and you want to wire the stuff yourself, instantiate the helper config, grab the view helper manager and inject it:
// $renderer is the Zend\View\Renderer\PhpRenderer
$plugins = $renderer->getHelperPluginManager();
$config = new Zend\Form\View\HelperConfig;
$config->configureServiceManager($plugins);