Open BnitoBzh opened 7 years ago
Can you posy code example?
I am using wiki example. see https://github.com/ZF-Commons/ZfcUser/wiki/How-to-modify-the-form-objects-used-by-ZfcUser on bootstrap function, which is correctly executed.
$events = $e->getApplication()->getEventManager()->getSharedManager();
$events->attach('ZfcUser\Form\Register', 'init', function ($e) {
$form = $e->getTarget();
$form->add([
'name' => 'test',
'type' => 'Zend\Form\Element\Text',
'attributes' => [
'placeholder' => 'Test field'
]
]);
});
But there is no 'test' field displayed on register page. I think it's a problem with SharedManager and/or ProvidesEventsForm class due to the new version of zend framework.
Confirm that. Already pointed out the same issue in ZF3 compatibility https://github.com/ZF-Commons/ZfcUser/issues/642#issuecomment-246374938 The issue exists in released zf-commons/zfc-user 3.0.0.
Confirm. Problem is that init method is called in constructor, where is not yet injected event-manager with sharedmanager... Prefer to use Delegator to fix that.
I have struggled with this problem, and found it easier for my use case to work with the components in Zend\Authorization directly. You don't get all the bells and whistles that ZfcUser used to provide out of the box, but you also do not get the pain of customization.
I am migrating my application from ZF2 to ZF3. All dependencies work as expected on ZF3 except ZfcUser with form customization by events ... In order to test in good conditions, i have tested this function in an empty new ZF3 project based on ZendSkeletonApplication. But nothing works as expected for the form customization feature.
The ZfcUser module version 2.* hasn't be updated from 7 months, Is there always maintained for ZF3 ?