我试图在寄存器中的zfcuser模块中添加新的寄存器字段。我有问题BCS新领域中register.phtml
Zfcuser添加寄存器字段
不会呈现我该怎么办:
首先我在自定义模块创建新User
实体和扩展\ZfcUser\Entity\User
,并添加新的特性protected $first_name
并把getter方法。
其次,我在config中更改user_entity_class' => 'MyModule\Entity\User
。
三,我创建自定义窗体类,其中我扩展\ZfcUser\Form\Register
其中我创建两个方法__constructor($name,RegistrationOptionsInterface $options)
,第二init()
。这看起来是这样的:
// 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'
),
));
}
和我模块注册此类似sercice:
public function getServiceConfig()
{
return array(
'factories' => array(
'clientRegisterForm' => function($sm) {
$clientRegisterForm = new ClientRegisterForm(null, array());
return $clientRegisterForm;
}
)
);
}
所以问题是BCS zfcuser不知道任何关于新领域。循环列表只是默认字段。如何以这种方式通知zfcuser模块关于新领域?
register.phtml
<?php foreach ($form as $element): ?>
<?php echo $this->formInput($element) . $this->formElementErrors($element) ?>
<?php endforech; ?>