var/classes/DataObject/CarouselSlide.php line 27

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - title [input]
  8.  * - content [wysiwyg]
  9.  * - image [image]
  10.  * - page [manyToOneRelation]
  11.  */
  12. namespace Pimcore\Model\DataObject;
  13. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  14. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  15. /**
  16. * @method static \Pimcore\Model\DataObject\CarouselSlide\Listing getList(array $config = [])
  17. * @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByTitle($value, $limit = 0, $offset = 0, $objectTypes = null)
  18. * @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByContent($value, $limit = 0, $offset = 0, $objectTypes = null)
  19. * @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  20. * @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByPage($value, $limit = 0, $offset = 0, $objectTypes = null)
  21. */
  22. class CarouselSlide extends Concrete
  23. {
  24. protected $o_classId "2";
  25. protected $o_className "CarouselSlide";
  26. protected $title;
  27. protected $content;
  28. protected $image;
  29. protected $page;
  30. /**
  31. * @param array $values
  32. * @return \Pimcore\Model\DataObject\CarouselSlide
  33. */
  34. public static function create($values = array()) {
  35.     $object = new static();
  36.     $object->setValues($values);
  37.     return $object;
  38. }
  39. /**
  40. * Get title - Titel
  41. * @return string|null
  42. */
  43. public function getTitle(): ?string
  44. {
  45.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  46.         $preValue $this->preGetValue("title");
  47.         if ($preValue !== null) {
  48.             return $preValue;
  49.         }
  50.     }
  51.     $data $this->title;
  52.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  53.         return $data->getPlain();
  54.     }
  55.     return $data;
  56. }
  57. /**
  58. * Set title - Titel
  59. * @param string|null $title
  60. * @return \Pimcore\Model\DataObject\CarouselSlide
  61. */
  62. public function setTitle(?string $title)
  63. {
  64.     $this->title $title;
  65.     return $this;
  66. }
  67. /**
  68. * Get content - Inhoud
  69. * @return string|null
  70. */
  71. public function getContent(): ?string
  72. {
  73.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  74.         $preValue $this->preGetValue("content");
  75.         if ($preValue !== null) {
  76.             return $preValue;
  77.         }
  78.     }
  79.     $data $this->getClass()->getFieldDefinition("content")->preGetData($this);
  80.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  81.         return $data->getPlain();
  82.     }
  83.     return $data;
  84. }
  85. /**
  86. * Set content - Inhoud
  87. * @param string|null $content
  88. * @return \Pimcore\Model\DataObject\CarouselSlide
  89. */
  90. public function setContent(?string $content)
  91. {
  92.     $this->content $content;
  93.     return $this;
  94. }
  95. /**
  96. * Get image - Afbeelding
  97. * @return \Pimcore\Model\Asset\Image|null
  98. */
  99. public function getImage(): ?\Pimcore\Model\Asset\Image
  100. {
  101.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  102.         $preValue $this->preGetValue("image");
  103.         if ($preValue !== null) {
  104.             return $preValue;
  105.         }
  106.     }
  107.     $data $this->image;
  108.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  109.         return $data->getPlain();
  110.     }
  111.     return $data;
  112. }
  113. /**
  114. * Set image - Afbeelding
  115. * @param \Pimcore\Model\Asset\Image|null $image
  116. * @return \Pimcore\Model\DataObject\CarouselSlide
  117. */
  118. public function setImage(?\Pimcore\Model\Asset\Image $image)
  119. {
  120.     $this->image $image;
  121.     return $this;
  122. }
  123. /**
  124. * Get page - Pagina
  125. * @return \Pimcore\Model\Document\Page|null
  126. */
  127. public function getPage(): ?\Pimcore\Model\Element\AbstractElement
  128. {
  129.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  130.         $preValue $this->preGetValue("page");
  131.         if ($preValue !== null) {
  132.             return $preValue;
  133.         }
  134.     }
  135.     $data $this->getClass()->getFieldDefinition("page")->preGetData($this);
  136.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  137.         return $data->getPlain();
  138.     }
  139.     return $data;
  140. }
  141. /**
  142. * Set page - Pagina
  143. * @param \Pimcore\Model\Document\Page|null $page
  144. * @return \Pimcore\Model\DataObject\CarouselSlide
  145. */
  146. public function setPage(?\Pimcore\Model\Element\AbstractElement $page)
  147. {
  148.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  149.     $fd $this->getClass()->getFieldDefinition("page");
  150.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  151.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  152.     $currentData $this->getPage();
  153.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  154.     $isEqual $fd->isEqual($currentData$page);
  155.     if (!$isEqual) {
  156.         $this->markFieldDirty("page"true);
  157.     }
  158.     $this->page $fd->preSetData($this$page);
  159.     return $this;
  160. }
  161. }