| @@ 99-104 (lines=6) @@ | ||
| 96 | public function getHref() { |
|
| 97 | $href = !empty(\App::$primary->config['defaultModule']) && \App::$primary->config['defaultModule'] == 'Materials' ? '/category' : '/materials/category'; |
|
| 98 | $treePath = array_filter(explode('/', $this->tree_path)); |
|
| 99 | if ($treePath) { |
|
| 100 | $categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]); |
|
| 101 | foreach ($categorys as $category) { |
|
| 102 | $href .= "/{$category->alias}"; |
|
| 103 | } |
|
| 104 | } |
|
| 105 | return $href . "/" . ($this->alias ? $this->alias : $this->pk()); |
|
| 106 | } |
|
| 107 | ||
| @@ 139-146 (lines=8) @@ | ||
| 136 | public function getHref() { |
|
| 137 | $href = !empty(\App::$primary->config['defaultModule']) && \App::$primary->config['defaultModule'] == 'Materials' ? '' : '/materials'; |
|
| 138 | $treePath = array_filter(explode('/', $this->tree_path)); |
|
| 139 | if ($treePath) { |
|
| 140 | $categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]); |
|
| 141 | foreach ($categorys as $category) { |
|
| 142 | if ($category->alias) { |
|
| 143 | $href .= "/{$category->alias}"; |
|
| 144 | } |
|
| 145 | } |
|
| 146 | } |
|
| 147 | if ((!$href || $href == '/materials') && !$this->alias) { |
|
| 148 | return ($href ? $href : '/materials') . '/view/' . $this->pk(); |
|
| 149 | } |
|