Bolt\Storage\Entity\ContentValuesTrait::getImage PHP Метод

getImage() публичный Метод

Get the first image in the content.
public getImage ( ) : string
Результат string
    public function getImage()
    {
        // No fields, no image.
        if (empty($this->contenttype['fields'])) {
            return '';
        }
        // Grab the first field of type 'image', and return that.
        foreach ($this->contenttype['fields'] as $key => $field) {
            if ($field['type'] === 'image' && isset($this->values[$key])) {
                // After v1.5.1 we store image data as an array
                if (is_array($this->values[$key])) {
                    return isset($this->values[$key]['file']) ? $this->values[$key]['file'] : '';
                }
                return $this->values[$key];
            }
        }
        // otherwise, no image.
        return '';
    }