@@ 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. |
@@ 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 = array_get($arguments, 0); |
|
166 | $attributes = array_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. |