skeeks\cms\relatedProperties\propertyTypes\PropertyTypeElement::getStringValue PHP Method

getStringValue() public method

public getStringValue ( ) : string
return string
    public function getStringValue()
    {
        $value = $this->property->relatedPropertiesModel->getAttribute($this->property->code);
        if ($this->isMultiple) {
            $data = ArrayHelper::map(CmsContentElement::find()->where(['id' => $value])->all(), 'id', 'name');
            return implode(', ', $data);
        } else {
            if ($element = CmsContentElement::find()->where(['id' => $value])->one()) {
                return $element->name;
            }
            return "";
        }
    }