src/Factory/Form/ChangeEmailFormFactory.php
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $services = $serviceLocator->getServiceLocator();
        /* @var $options FormOptionsInterface */
        $options = $services->get(ModuleOptions::class);

        $creationOptions = $options->toArray();
        $creationOptions['label'] = 'Changing Email Address';

        /* @var $form FormInterface */
        $form = $serviceLocator->get($options->getUserEntityClass(), $creationOptions);
        $form->setName('change-email-form');
        $form->setElementGroup([
            'question',
            'answerVerify',
            'email',
        ])->setValidationGroup([
            'answerVerify',
            'email',
        ]);

        $form->get('email')->setLabel('New Email');

        return $form;
    }
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $services = $serviceLocator->getServiceLocator();
        /* @var $options FormOptionsInterface */
        $options = $services->get(ModuleOptions::class);

        $creationOptions = $options->toArray();
        $creationOptions['label'] = 'Changing Email Address';

        /* @var $form FormInterface */
        $form = $serviceLocator->get($options->getUserEntityClass(), $creationOptions);
        $form->setName('change-email-form');
        $form->setElementGroup([
            'question',
            'answerVerify',
            'email',
        ])->setValidationGroup([
            'answerVerify',
            'email',
        ]);

        $form->get('email')->setLabel('New Email');

        return $form;
    }
{@inheritDoc}

@return FormInterface