common\services\PostService::contentReplaceTag PHP Method

contentReplaceTag() public static method

public static contentReplaceTag ( $content )
    public static function contentReplaceTag($content)
    {
        $content = preg_replace_callback('/#(\\S+?)#/', function ($matches) {
            $tagName = $matches[1];
            return sprintf('[%s](%s)', "#{$tagName}#", Url::to(['/tweet/default/index', 'topic' => $tagName]));
        }, $content);
        return $content;
    }