Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form customization not working on lastest ZF3 version. #665

Open
BnitoBzh opened this issue Mar 17, 2017 · 5 comments
Open

Form customization not working on lastest ZF3 version. #665

BnitoBzh opened this issue Mar 17, 2017 · 5 comments

Comments

@BnitoBzh
Copy link
Contributor

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 ?

@stijnhau
Copy link

Can you posy code example?

@BnitoBzh
Copy link
Contributor Author

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.

@olexp
Copy link

olexp commented May 24, 2017

Confirm that. Already pointed out the same issue in ZF3 compatibility #642 (comment)
The issue exists in released zf-commons/zfc-user 3.0.0.

@snapshotpl
Copy link

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.

@bartmcleod
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants