Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
29 | public function create(ChatControl $chatControl): Form { |
||
30 | $form = new Form(); |
||
31 | $form->setTranslator($this->translator); |
||
32 | $form->addText("message") |
||
33 | ->setRequired("chat.newMessageForm.messageField.empty"); |
||
34 | $form->addSubmit("send", "chat.newMessageForm.submitButton.label"); |
||
35 | $form->addComponent($chatControl, "chat"); |
||
36 | $form->onSuccess[] = function(Form $form, array $values) { |
||
37 | /** @var ChatControl $chat */ |
||
38 | $chat = $form->getComponent("chat"); |
||
39 | $chat->newMessage($values["message"]); |
||
40 | }; |
||
41 | return $form; |
||
42 | } |
||
44 | ?> |