| @@ 348-368 (lines=21) @@ | ||
| 345 | * |
|
| 346 | * @return $this |
|
| 347 | */ |
|
| 348 | public function dropdown($title, \Closure $callback, $order = null, array $attributes = array()) |
|
| 349 | { |
|
| 350 | $properties = compact('title', 'order', 'attributes'); |
|
| 351 | ||
| 352 | if (func_num_args() == 3) { |
|
| 353 | $arguments = func_get_args(); |
|
| 354 | ||
| 355 | $title = Arr::get($arguments, 0); |
|
| 356 | $attributes = Arr::get($arguments, 2); |
|
| 357 | ||
| 358 | $properties = compact('title', 'attributes'); |
|
| 359 | } |
|
| 360 | ||
| 361 | $item = MenuItem::make($properties); |
|
| 362 | ||
| 363 | call_user_func($callback, $item); |
|
| 364 | ||
| 365 | $this->items[] = $item; |
|
| 366 | ||
| 367 | return $item; |
|
| 368 | } |
|
| 369 | ||
| 370 | /** |
|
| 371 | * Register new menu item using registered route. |
|
| @@ 158-178 (lines=21) @@ | ||
| 155 | * |
|
| 156 | * @return $this |
|
| 157 | */ |
|
| 158 | public function dropdown($title, \Closure $callback, $order = 0, array $attributes = array()) |
|
| 159 | { |
|
| 160 | $properties = compact('title', 'order', 'attributes'); |
|
| 161 | ||
| 162 | if (func_num_args() === 3) { |
|
| 163 | $arguments = func_get_args(); |
|
| 164 | ||
| 165 | $title = Arr::get($arguments, 0); |
|
| 166 | $attributes = Arr::get($arguments, 2); |
|
| 167 | ||
| 168 | $properties = compact('title', 'attributes'); |
|
| 169 | } |
|
| 170 | ||
| 171 | $child = static::make($properties); |
|
| 172 | ||
| 173 | call_user_func($callback, $child); |
|
| 174 | ||
| 175 | $this->childs[] = $child; |
|
| 176 | ||
| 177 | return $child; |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * Create new menu item and set the action to route. |
|