/** * Add dropdown item to menu collection * * @access public * @param array $attributes * @return $this */ public function dropdown(array $attributes, Closure $callback = null) { $attributes = array_merge(['items' => []], $attributes); $item = Dropdown::make($attributes); if (false === is_null($callback)) { call_user_func($callback, $item); } $this->items[] = $item; return $this; }
/** * Create dropdown item * * @access public * @param array $attributes (default: []) * @param Closure $callback * @return $this */ public function dropdown(array $attributes, Closure $callback) { $items = $this->get('items'); $attributes = array_merge(['items' => []], $attributes); $list = Dropdown::make($attributes); if (false === is_null($callback)) { call_user_func($callback, $list); } $items[] = $list; $this->set('items', $items); return $this; }