creocoder\taggable\TaggableBehavior::getTagValues PHP Method

getTagValues() public method

Returns tags.
public getTagValues ( boolean | null $asArray = null ) : string | string[]
$asArray boolean | null
return string | string[]
    public function getTagValues($asArray = null)
    {
        if (!$this->owner->getIsNewRecord() && $this->_tagValues === null) {
            $this->_tagValues = [];
            /* @var ActiveRecord $tag */
            foreach ($this->owner->{$this->tagRelation} as $tag) {
                $this->_tagValues[] = $tag->getAttribute($this->tagValueAttribute);
            }
        }
        if ($asArray === null) {
            $asArray = $this->tagValuesAsArray;
        }
        if ($asArray) {
            return $this->_tagValues === null ? [] : $this->_tagValues;
        } else {
            return $this->_tagValues === null ? '' : implode(', ', $this->_tagValues);
        }
    }