fnagel / generic-gallery

TYPO3 extension: Generic Gallery - One gallery to rule them all!
https://extensions.typo3.org/extension/generic_gallery/
GNU General Public License v3.0
7 stars 12 forks source link

Extension throws exception if no image title was set #58

Closed mediaessenz closed 7 months ago

mediaessenz commented 7 months ago

If the title of an image is not set, the extension throws the following exception:

(1/1) TypeError

FelixNagel\GenericGallery\Domain\Model\GalleryItem::getTitle(): Return value must be of type string, null returned

To reproduce add the plugin on a page, go to the plugins-tab, add an image without a title at the "multible images" section, save and open the page in the frontend.

Easy fixable by changing corresponding model getter from this:

public function getTitle(): string
    {
        if ($this->isVirtual()) {
            return $this->getImageData()['title'];
        }

        return $this->title;
    }

to this:

public function getTitle(): string
    {
        if ($this->isVirtual()) {
            return $this->getImageData()['title'] ?? '';
        }

        return $this->title;
    }
fnagel commented 7 months ago

Tested and confirmed. Merged your PR into master.

Thanks for your contribution!