I faced a problem with laminas-form rendering in an application using laminas-mvc. The form components were not rendered without explicit configuration in module.config.php. The view helper throwed an exception if the configuration was absent. No finding something about it in documentation, I followed to writing the configuration for each form component. For being more clear, I needed to have this in my module.config.php:
'view_helpers' => [
'aliases' => [
'form' => Form::class,
'formText' => FormText::class,
'formSelect' => FormSelect::class,
'formNumber' => FormNumber::class,
'formHidden' => FormHidden::class,
'formLabel' => FormLabel::class,
'formPassword' => FormPassword::class
],
'factories' => [
Form::class => InvokableFactory::class,
FormText::class => InvokableFactory::class,
FormSelect::class => InvokableFactory::class,
FormNumber::class => InvokableFactory::class,
FormHidden::class => InvokableFactory::class,
FormLabel::class => InvokableFactory::class,
FormPassword::class => InvokableFactory::class
]
]
Another developer said me that it is not necessary. The problem was the absence of laminas-mvc-form in composer.json. Well, I removed this part and added laminas-mvc-form with a composer require laminas/laminas-mvc-form. The result is that Laminas/Form is not found.
I would like a clarification. What is the right procedure for enabling the form rendering? The concise documentation of laminas-mvc-form does not seem to tell me that it is a coupling component, which is necessary to enable form rendering when laminas-form is used in combination with laminas-mvc. In fact, we didn’t find references about laminas-mvc-form as an required component to use forms in laminas-mvc based applications.
If there is a documentation about it, please let me know the address. Thank you very much!