1 | <?php |
||
13 | class AddCommentForm extends FormModel |
||
14 | { |
||
15 | /** |
||
16 | * Constructor injects with DI container. |
||
17 | * |
||
18 | * @param Anax\DI\DIInterface $di a service container |
||
19 | */ |
||
20 | 1 | public function __construct(DIInterface $di) |
|
21 | { |
||
22 | 1 | parent::__construct($di); |
|
23 | |||
24 | 1 | $this->form->create( |
|
25 | [ |
||
26 | 1 | "id" => __CLASS__, |
|
27 | 1 | "use_fieldset" => false, |
|
28 | 1 | ], |
|
29 | 1 | [ |
|
30 | "content" => [ |
||
31 | 1 | "type" => "textarea", |
|
32 | 1 | "label" => "Kommentar", |
|
33 | 1 | "validation" => ["not_empty"], |
|
34 | 1 | ], |
|
35 | |||
36 | "submit" => [ |
||
37 | 1 | "type" => "submit", |
|
38 | 1 | "value" => "Spara kommentar", |
|
39 | 1 | "callback" => [$this, "callbackSubmit"], |
|
40 | "class" => "btn" |
||
41 | 1 | ], |
|
42 | ] |
||
43 | 1 | ); |
|
44 | 1 | } |
|
45 | |||
46 | |||
47 | /** |
||
48 | * Callback for submit-button which should return true if it could |
||
49 | * carry out its work and false if something failed. |
||
50 | * |
||
51 | * @return boolean true if okey, false if something went wrong. |
||
52 | */ |
||
53 | public function callbackSubmit() |
||
70 | } |
||
71 |