<?php
namespace Cms\Modules\GalleryBundle\Model\Gallery;
use Cms\ModuleBundle\Entity\SocialMetadata;
use Cms\ModuleBundle\Entity\StandardMetadata;
use Cms\ModuleBundle\Model\Data;
use Cms\FileBundle\Entity\Nodes\File;
use Cms\ModuleBundle\Model\Interfaces\Sociable\SociableInterface;
use Cms\Modules\GalleryBundle\Model\GalleryEntry;
use Cms\TagBundle\Model\Taggable\TaggableInterface;
use Cms\TagBundle\Model\Taggable\TaggableModuleDataTrait;
use Common\Util\Strings;
use DateTime;
/**
* Class GalleryData
* @package Cms\Modules\GalleryBundle\Model\Gallery
*
* @method string getTitle()
* @method string getSlug()
* @method string getDescription()
* @method File getImage()
* @method SocialMetadata getSocial()
* @method StandardMetadata getStandardMetadata()
* @method string getAbstract()
* @method string|array|GalleryEntry getEntries()
* @method DateTime getTimestamp()
* @method File|null getSocialImage()
* @method GalleryData setTitle($value)
* @method GalleryData setSlug($value)
* @method GalleryData setDescription($value)
* @method GalleryData setImage(File $value)
* @method GalleryData setSocial(SocialMetadata $value)
* @method GalleryData setAbstract($value)
* @method GalleryData setEntries(string|array|GalleryEntry[] $value)
* @method GalleryData setTimestamp(DateTime $value)
* @method GalleryData setSocialImage(File|null $value)
*/
final class GalleryData extends Data implements TaggableInterface, SociableInterface
{
const TYPE = 'Gallery';
use TaggableModuleDataTrait;
/**
* {@inheritDoc}
*/
public function getSocialMetadata(): array
{
return [
'og:type' => 'website',
'title' => $this->getStandardMetadata()->getTitle() ?: $this->getTitle(),
'image' => $this->getSocialImage() ?: $this->getImage(),
'cs:image-presized' => ( ! empty($this->getSocialImage())),
'description' => $this->getStandardMetadata()->getDescription() ?: Strings::htmltidytrim($this->getDescription()),
];
}
/**
* {@inheritdoc}
*/
public function ui()
{
return $this->getTitle();
}
}