function addBreadCrumb($as = null, $replaced = []) { $this->replaced = array_merge($this->replaced, $replaced); $h1_ext = Route::get_h1_ext($as); $title = Route::get_title($as); $url = Route::get_url($as); foreach ($this->replaced as $k => $v) { $k = '{' . $k . '}'; $h1_ext = str_replace($k, $v, $h1_ext); $title = str_replace($k, $v, $title); $url = str_replace($k, $v, $url); } WidgetH1::factory()->setH1($title)->setH1Ext($h1_ext); WidgetMetaTags::factory()->setDescription($h1_ext); \Larakit\Page\Page::addBreadCrumb($title, $url); }
/** * @param $access_name * @param $text * @param $url * @param array $attrs * * @return $this */ function addItem($as, $key, $attrs = []) { if (!Route::isEnable($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 { $text = Route::get_title($as); $icon = Route::get_icon($as); $url = Route::get_url($as); } if ($icon) { $text = \HtmlI::setTitle($text)->addClass($icon) . ' ' . \HtmlSpan::setContent($text); } $this->map->add($key, $as, $text, $url, $attrs); return $this; }