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