src/Cms/Modules/GalleryBundle/Model/Gallery/GalleryData.php line 40

Open in your IDE?
  1. <?php
  2. namespace Cms\Modules\GalleryBundle\Model\Gallery;
  3. use Cms\ModuleBundle\Entity\SocialMetadata;
  4. use Cms\ModuleBundle\Entity\StandardMetadata;
  5. use Cms\ModuleBundle\Model\Data;
  6. use Cms\FileBundle\Entity\Nodes\File;
  7. use Cms\ModuleBundle\Model\Interfaces\Sociable\SociableInterface;
  8. use Cms\Modules\GalleryBundle\Model\GalleryEntry;
  9. use Cms\TagBundle\Model\Taggable\TaggableInterface;
  10. use Cms\TagBundle\Model\Taggable\TaggableModuleDataTrait;
  11. use Common\Util\Strings;
  12. use DateTime;
  13. /**
  14.  * Class GalleryData
  15.  * @package Cms\Modules\GalleryBundle\Model\Gallery
  16.  *
  17.  * @method string getTitle()
  18.  * @method string getSlug()
  19.  * @method string getDescription()
  20.  * @method File getImage()
  21.  * @method SocialMetadata getSocial()
  22.  * @method StandardMetadata getStandardMetadata()
  23.  * @method string getAbstract()
  24.  * @method string|array|GalleryEntry getEntries()
  25.  * @method DateTime getTimestamp()
  26.  * @method File|null getSocialImage()
  27.  * @method GalleryData setTitle($value)
  28.  * @method GalleryData setSlug($value)
  29.  * @method GalleryData setDescription($value)
  30.  * @method GalleryData setImage(File $value)
  31.  * @method GalleryData setSocial(SocialMetadata $value)
  32.  * @method GalleryData setAbstract($value)
  33.  * @method GalleryData setEntries(string|array|GalleryEntry[] $value)
  34.  * @method GalleryData setTimestamp(DateTime $value)
  35.  * @method GalleryData setSocialImage(File|null $value)
  36.  */
  37. final class GalleryData extends Data implements TaggableInterfaceSociableInterface
  38. {
  39.     const TYPE 'Gallery';
  40.     use TaggableModuleDataTrait;
  41.     /**
  42.      * {@inheritDoc}
  43.      */
  44.     public function getSocialMetadata(): array
  45.     {
  46.         return [
  47.             'og:type' => 'website',
  48.             'title' => $this->getStandardMetadata()->getTitle() ?: $this->getTitle(),
  49.             'image' => $this->getSocialImage() ?: $this->getImage(),
  50.             'cs:image-presized' => ( ! empty($this->getSocialImage())),
  51.             'description' => $this->getStandardMetadata()->getDescription() ?: Strings::htmltidytrim($this->getDescription()),
  52.         ];
  53.     }
  54.     /**
  55.      * {@inheritdoc}
  56.      */
  57.     public function ui()
  58.     {
  59.         return $this->getTitle();
  60.     }
  61. }