| @@ 155-171 (lines=17) @@ | ||
| 152 | * @param Row $row |
|
| 153 | * @return string |
|
| 154 | */ |
|
| 155 | public function getTitle(Row $row) |
|
| 156 | { |
|
| 157 | /** |
|
| 158 | * If user callback was used for setting action title, it has to return string |
|
| 159 | */ |
|
| 160 | if (is_callable($this->title)) { |
|
| 161 | $title = call_user_func($this->title, $row->getItem()); |
|
| 162 | ||
| 163 | if (!is_string($title)) { |
|
| 164 | throw new DataGridException('Action class callback has to return string'); |
|
| 165 | } |
|
| 166 | ||
| 167 | return $title; |
|
| 168 | } |
|
| 169 | ||
| 170 | return $this->title; |
|
| 171 | } |
|
| 172 | ||
| 173 | ||
| 174 | /** |
|
| @@ 198-214 (lines=17) @@ | ||
| 195 | * @param Row $row |
|
| 196 | * @return string |
|
| 197 | */ |
|
| 198 | public function getClass(Row $row) |
|
| 199 | { |
|
| 200 | /** |
|
| 201 | * If user callback was used for setting action class, it has to return string |
|
| 202 | */ |
|
| 203 | if (is_callable($this->class)) { |
|
| 204 | $class = call_user_func($this->class, $row->getItem()); |
|
| 205 | ||
| 206 | if (!is_string($class)) { |
|
| 207 | throw new DataGridException('Action class callback has to return string'); |
|
| 208 | } |
|
| 209 | ||
| 210 | return $class; |
|
| 211 | } |
|
| 212 | ||
| 213 | return $this->class; |
|
| 214 | } |
|
| 215 | ||
| 216 | ||
| 217 | /** |
|
| @@ 241-257 (lines=17) @@ | ||
| 238 | * @param Row $row |
|
| 239 | * @return string |
|
| 240 | */ |
|
| 241 | public function getIcon(Row $row) |
|
| 242 | { |
|
| 243 | /** |
|
| 244 | * If user callback was used for setting action icon, it has to return string |
|
| 245 | */ |
|
| 246 | if (is_callable($this->icon)) { |
|
| 247 | $icon = call_user_func($this->icon, $row->getItem()); |
|
| 248 | ||
| 249 | if (!is_string($icon)) { |
|
| 250 | throw new DataGridException('Action icon callback has to return string'); |
|
| 251 | } |
|
| 252 | ||
| 253 | return $icon; |
|
| 254 | } |
|
| 255 | ||
| 256 | return $this->icon; |
|
| 257 | } |
|
| 258 | ||
| 259 | ||
| 260 | /** |
|