Hey
Folgende Funktion hab ich in meiner AddForm-Klasse:
Code
protected function createForm()
{
parent::createForm();
$this->form->appendChild(
FormContainer::create('data')
->label('wcf.global.form.data')
->appendChildren([
TextFormField::create('todoName')
->label('todolist.column.todoName')
->required()
->autoFocus()
->maximumLength(255),
MultilineTextFormField::create('description')
->label('todolist.column.description')
->required()
->maximumLength(8192),
BooleanFormField::create('done')
->label('todolist.column.done')
->value(false),
])
);
}
Display More
jetzt möchte ich per Event-Listener ein Feld hinzufügen.
Ich hab probiert denselben Code nochmal mit nur dem neuen Feld (zuvor auch schon mit allen plus dem neuen Feld) aufzurufen. Wie erwartet hat das leider nicht geklappt, da Non-unique node id 'data'.
Code
class TodoAddEventListener implements IParameterizedEventListener {
/**
* @inheritDoc
*/
public function execute($eventObj, $className, $eventName, array &$parameters) {
$this->$eventName($eventObj);
}
/**
* @inheritDoc
*/
protected function createForm(TodoAddForm $eventObj)
{
$eventObj->form->appendChild(
FormContainer::create('data')
->label('wcf.global.form.data')
->appendChildren([
BooleanFormField::create('enableComments')
->label('todolist.comments.enable')
->description('todolist.comments.enable.description')
->value(true),
])
);
}
}
Display More
Kann mir jemand auf die Sprünge helfen, wie ich dem vorhandenen FormContainer ein Feld hinzufügen kann?
Danke im Voraus
LG