1 | <?php |
||
12 | class AdminDeleteUserForm extends FormModel |
||
13 | { |
||
14 | /** |
||
15 | * Constructor injects with DI container. |
||
16 | * |
||
17 | * @param Anax\DI\DIInterface $di a service container |
||
18 | */ |
||
19 | public function __construct(DIInterface $di) |
||
20 | { |
||
21 | parent::__construct($di); |
||
22 | $this->form->create( |
||
23 | [ |
||
24 | "id" => __CLASS__, |
||
25 | "legend" => "Delete an item", |
||
26 | ], |
||
27 | [ |
||
28 | "select" => [ |
||
29 | "type" => "select", |
||
30 | "label" => "Select item to delete:", |
||
31 | "options" => $this->getAllItems(), |
||
32 | ], |
||
33 | |||
34 | "submit" => [ |
||
35 | "type" => "submit", |
||
36 | "value" => "Delete item", |
||
37 | "callback" => [$this, "callbackSubmit"], |
||
38 | ], |
||
39 | ] |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | |||
44 | /** |
||
45 | * Get all items as array suitable for display in select option dropdown. |
||
46 | * |
||
47 | * @return array with key value of all items. |
||
48 | */ |
||
49 | protected function getAllItems() |
||
61 | |||
62 | |||
63 | /** |
||
64 | * Callback for submit-button which should return true if it could |
||
65 | * carry out its work and false if something failed. |
||
66 | * |
||
67 | * @return boolean true if okey, false if something went wrong. |
||
68 | */ |
||
69 | public function callbackSubmit() |
||
77 | } |
||
78 |