Caffeinated\Menus\Builder::dispatch PHP Method

dispatch() public method

Get the action type from the options.
public dispatch ( array $options ) : string
$options array
return string
    public function dispatch($options)
    {
        if (isset($options['url'])) {
            return $this->getUrl($options);
        } elseif (isset($options['route'])) {
            return $this->getRoute($options['route']);
        } elseif (isset($options['action'])) {
            return $this->getAction($options['action']);
        }
        return null;
    }

Usage Example

コード例 #1
0
ファイル: Item.php プロジェクト: tok3/menus
 /**
  * Generates a valid URL for the menu item.
  *
  * @return string
  */
 public function url()
 {
     if (!is_null($this->link)) {
         if ($this->link->href) {
             return $this->link->href;
         }
         return $this->builder->dispatch($this->link->path);
     }
 }