How to Override Users Module to add additional fields in Registration Form Builder?

srinivas214 - 2 months ago

Hi, Could any one help me on how to override the Registration form in Users Module to add additional Fields like Confirm Password, Mobile Number etc.

class RegisterFormBuilder extends FormBuilder {

/**
 * The form roles.
 *
 * @var array
 */
protected $roles = [
    'user',
];

/**
 * The form model.
 *
 * @var string
 */
protected $model = 'Anomaly\UsersModule\User\UserModel';

/**
 * The form fields.
 *
 * @var array
 */
protected $fields = [
    'display_name' => [
        'instructions' => false,
    ],
    'username'     => [
        'instructions' => false,
    ],
    'email'        => [
        'instructions' => false,
    ],
    'password'     => [
        'instructions' => false,
        'rules'        => [
            'valid_password',
        ],
        'validators'   => [
            'valid_password' => [
                'message' => false,
                'handler' => ValidatePassword::class,
            ],
        ],
    ],

];

I would need to extend the above class and add more fields in to the registration form. Is there a way to do this?