1 | <?php |
||
28 | class Button extends Component |
||
29 | 1 | { |
|
30 | const ID = 'buttons'; |
||
31 | |||
32 | /** @var string first param for method $presenter->link() */ |
||
33 | protected $destination; |
||
34 | |||
35 | /** @var array second param for method $presenter->link() */ |
||
36 | protected $arguments = []; |
||
37 | |||
38 | /** @var Html <a> html tag */ |
||
39 | protected $elementPrototype; |
||
40 | |||
41 | /** @var array */ |
||
42 | protected $options = []; |
||
43 | |||
44 | /** |
||
45 | * @param Grid $grid |
||
46 | * @param string $name |
||
47 | * @param string $label |
||
48 | * @param string $destination - first param for method $presenter->link() |
||
49 | * @param array $arguments - second param for method $presenter->link() |
||
50 | */ |
||
51 | public function __construct(Grid $grid, $name, $label = NULL, $destination = NULL, array $arguments = []) |
||
59 | |||
60 | /** |
||
61 | * Sets name of icon. |
||
62 | * @param string $name |
||
63 | * @return Action |
||
64 | */ |
||
65 | public function setIcon($name) |
||
70 | |||
71 | /** |
||
72 | * Sets user-specific option. |
||
73 | * @param string $key |
||
74 | * @param mixed $value |
||
75 | * @return Action |
||
76 | */ |
||
77 | public function setOption($key, $value) |
||
88 | |||
89 | /** |
||
90 | * Sets html element. |
||
91 | * @param Html $elementPrototype |
||
92 | * @return Button |
||
93 | */ |
||
94 | public function setElementPrototype(Html $elementPrototype) |
||
99 | |||
100 | /**********************************************************************************************/ |
||
101 | |||
102 | /** |
||
103 | * @return Html |
||
104 | * @internal |
||
105 | */ |
||
106 | public function getElement() |
||
115 | |||
116 | /** |
||
117 | * Returns element prototype (<a> html tag). |
||
118 | * @return Html |
||
119 | * @throws Exception |
||
120 | */ |
||
121 | public function getElementPrototype() |
||
135 | |||
136 | /** |
||
137 | * Returns user-specific option. |
||
138 | * @param string $key |
||
139 | * @param mixed $default |
||
140 | * @return mixed |
||
141 | */ |
||
142 | public function getOption($key, $default = NULL) |
||
148 | |||
149 | /** |
||
150 | * Returns user-specific options. |
||
151 | * @return array |
||
152 | */ |
||
153 | public function getOptions() |
||
157 | |||
158 | /** |
||
159 | * @return string |
||
160 | * @internal |
||
161 | */ |
||
162 | public function getDestination() |
||
170 | |||
171 | /** |
||
172 | * @return array |
||
173 | * @internal |
||
174 | */ |
||
175 | public function getArguments() |
||
179 | |||
180 | /**********************************************************************************************/ |
||
181 | |||
182 | /** |
||
183 | * @throws Exception |
||
184 | * @return void |
||
185 | */ |
||
186 | public function render() |
||
190 | } |
||
191 |