1 | <?php |
||
12 | class CreateCommentForm extends FormModel |
||
13 | { |
||
14 | /** |
||
15 | * Constructor injects with DI container. |
||
16 | * |
||
17 | * @param Anax\DI\DIInterface $di a service container |
||
18 | */ |
||
19 | 1 | public function __construct(DIInterface $di) |
|
20 | { |
||
21 | 1 | parent::__construct($di); |
|
22 | 1 | $page = $this->di->session->get("previous"); |
|
23 | 1 | $acronym = $this->di->session->get("user"); |
|
24 | 1 | $this->form->create( |
|
25 | [ |
||
26 | 1 | "id" => __CLASS__, |
|
27 | 1 | "legend" => "Lämna en kommentar", |
|
28 | 1 | ], |
|
29 | 1 | [ |
|
30 | "comment" => [ |
||
31 | 1 | "type" => "textarea", |
|
32 | // "placeholder" => $page, |
||
33 | 1 | ], |
|
34 | "acronym" => [ |
||
35 | 1 | "type" => "hidden", |
|
36 | 1 | "value" => $acronym, |
|
37 | 1 | ], |
|
38 | "page" => [ |
||
39 | 1 | "type" => "hidden", |
|
40 | 1 | "value" => $page, |
|
41 | 1 | ], |
|
42 | "submit" => [ |
||
43 | 1 | "type" => "submit", |
|
44 | 1 | "value" => "Submit", |
|
45 | 1 | "callback" => [$this, "callbackSubmit"] |
|
46 | 1 | ], |
|
47 | ] |
||
48 | 1 | ); |
|
49 | 1 | } |
|
50 | |||
51 | |||
52 | |||
53 | /** |
||
54 | * Callback for submit-button which should return true if it could |
||
55 | * carry out its work and false if something failed. |
||
56 | * |
||
57 | * @return boolean true if okey, false if something went wrong. |
||
58 | */ |
||
59 | public function callbackSubmit() |
||
86 | } |
||
87 |