BlogHelper::getTag PHP Method

getTag() public method

複数所属する場合は複数取得する
public getTag ( array $post, string $separator = ' , ' ) : void
$post array 記事データ
$separator string 区切り文字(初期値 : , )
return void
    public function getTag($post, $separator = ' , ')
    {
        $tagLinks = array();
        if (!empty($post['BlogTag'])) {
            foreach ($post['BlogTag'] as $tag) {
                $url = $this->request->params['Content']['url'] . 'archives/tag/' . $tag['name'];
                $tagLinks[] = $this->BcBaser->getLink($tag['name'], $url);
            }
        }
        if ($tagLinks) {
            return implode($separator, $tagLinks);
        } else {
            return '';
        }
    }