Am trying to add new register fields in zfcuser moudle in register. I have problem bcs new fields not rendered in register.phtml
What i do:
First i create new User entity in my custom module and extend \ZfcUser\Entity\User, and add new properties protected $first_name and put getter method.
Second, i change user_entity_class' => 'MyModule\Entity\User in config.
Third, i create custom form class where i extend \ZfcUser\Form\Register where i create two methods __constructor($name,RegistrationOptionsInterface $options), second init(). THis look like this:
// Module/src/Mymod/Form
class ClientRegisterForm extends \ZfcUser\Form\Register
{
public function __construct($name, RegistrationOptionsInterface $options)
{
parent::__construct($name, $options);
}
/**
* {@inheritDoc}
*/
public function init(){
$this->add(array(
'name' => 'first_name',
'options' => array(
'label' => 'First name',
),
'attributes' => array(
'type' => 'text'
),
));
}
And i register this like sercice in module:
public function getServiceConfig()
{
return array(
'factories' => array(
'clientRegisterForm' => function($sm) {
$clientRegisterForm = new ClientRegisterForm(null, array());
return $clientRegisterForm;
}
)
);
}
So problem is bcs zfcuser dont know nothing about new field. Loop list just default fields. How to notify zfcuser module about new field in this way?
register.phtml
<?php foreach ($form as $element): ?>
<?php echo $this->formInput($element) . $this->formElementErrors($element) ?>
<?php endforech; ?>