@@ 145-165 (lines=21) @@ | ||
142 | * |
|
143 | * @return $this |
|
144 | */ |
|
145 | public function dropdown($title, \Closure $callback, $order = 0, array $attributes = array()) |
|
146 | { |
|
147 | $properties = compact('title', 'order', 'attributes'); |
|
148 | ||
149 | if (func_num_args() == 3) { |
|
150 | $arguments = func_get_args(); |
|
151 | ||
152 | $title = array_get($arguments, 0); |
|
153 | $attributes = array_get($arguments, 2); |
|
154 | ||
155 | $properties = compact('title', 'attributes'); |
|
156 | } |
|
157 | ||
158 | $child = static::make($properties); |
|
159 | ||
160 | call_user_func($callback, $child); |
|
161 | ||
162 | $this->childs[] = $child; |
|
163 | ||
164 | return $child; |
|
165 | } |
|
166 | ||
167 | /** |
|
168 | * Create new menu item and set the action to route. |
@@ 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. |