public function createService(ServiceLocatorInterface $formElementManager) { if ($formElementManager instanceof FormElementManager) { $sm = $formElementManager->getServiceLocator(); $fem = $formElementManager; } else { $sm = $formElementManager; $fem = $sm->get('FormElementManager'); } $options = $sm->get('zfcuser_module_options'); $form = new Form\ChangePassword(null, $options); // Inject the FormElementManager to support custom FormElements $form->getFormFactory()->setFormElementManager($fem); $form->setInputFilter(new Form\ChangePasswordFilter($options)); return $form; }