BlogHelper::getCategoryUrl PHP Method

getCategoryUrl() public method

[注意] リンク関数でラップする前提の為、ベースURLは考慮されない
public getCategoryUrl ( $blogCategoryId, array $options = [] ) : string
$options array オプション(初期値 : array()) `named` : URLの名前付きパラメーター
return string カテゴリ一覧へのURL
    public function getCategoryUrl($blogCategoryId, $options = array())
    {
        $options = array_merge(array('named' => array()), $options);
        extract($options);
        if (!isset($this->BlogCategory)) {
            $this->BlogCategory = ClassRegistry::init('Blog.BlogCategory');
        }
        $categoryPath = $this->BlogCategory->getPath($blogCategoryId);
        $blogContentId = $categoryPath[0]['BlogCategory']['blog_content_id'];
        $this->setContent($blogContentId);
        $path = array('category');
        if ($categoryPath) {
            foreach ($categoryPath as $category) {
                $path[] = urldecode($category['BlogCategory']['name']);
            }
        }
        if ($named) {
            $path = array_merge($path, $named);
        }
        $url = Router::url($this->request->params['Content']['url'] . 'archives/' . implode('/', $path));
        $baseUrl = preg_replace('/\\/$/', '', BC_BASE_URL);
        return preg_replace('/^' . preg_quote($baseUrl, '/') . '/', '', $url);
    }