예제 #1
0
 /**
  * @param       $access_name
  * @param       $text
  * @param       $url
  * @param array $attrs
  *
  * @return $this
  */
 function addItem($as, $key, $route_parameters = [])
 {
     if (is_string($as)) {
         if (!Route::isEnable($as)) {
             return $this;
         }
         if (Route::checkRouteFilters($as)) {
             return $this;
         }
         if (!count(Route::get($as))) {
             return $this;
         }
     }
     if (is_array($as)) {
         $text = Arr::get($as, 'title');
         $icon = Arr::get($as, 'icon');
         $url = Arr::get($as, 'url', '#');
         $as = Arr::get($as, 'as');
     } else {
         $keys = array_keys($route_parameters);
         $keys = array_map(function ($item) {
             return '{' . $item . '}';
         }, $keys);
         $text = str_replace($keys, array_values($route_parameters), Route::get_title($as));
         $icon = Route::get_icon($as);
         $url = \URL::route($as, $route_parameters);
     }
     if ($icon) {
         $text = \HtmlI::setTitle($text)->addClass($icon) . '  ' . \HtmlSpan::setContent($text);
     }
     if (!isset($this->maps[$this->section])) {
         $this->maps[$this->section] = Map::instance(get_called_class() . $this->name . $this->section);
     }
     if ($route_parameters) {
         $key .= '.' . str_replace(['&', '='], ['.', '-'], http_build_query($route_parameters));
     }
     $this->maps[$this->section]->add($key, $as, $text, $url);
     return $this;
 }
예제 #2
0
 /**
  * @param $access_name
  * @param $text
  * @param $url
  *
  * @return $this
  */
 function addItem($access_name, $text, $url)
 {
     Map::instance()->add($access_name, $text, $url);
     return $this;
 }
예제 #3
0
파일: WidgetNavBar.php 프로젝트: larakit/lk
 function __construct($name)
 {
     $this->map = Map::instance(get_called_class() . $name);
 }