var/classes/DataObject/Teaser.php line 34

Open in your IDE?
  1. <?php
  2. /**
  3. * Inheritance: no
  4. * Variants: no
  5. Fields Summary:
  6. - Title [input]
  7. - text [textarea]
  8. - colorLeft [select]
  9. - colorRight [select]
  10. - Image [image]
  11. - snippet [manyToOneRelation]
  12. - btnText [input]
  13. */
  14. namespace Pimcore\Model\DataObject;
  15. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  16. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  17. /**
  18. * @method static \Pimcore\Model\DataObject\Teaser\Listing getList(array $config = [])
  19. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByTitle($value, $limit = 0, $offset = 0, $objectTypes = null)
  20. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByText($value, $limit = 0, $offset = 0, $objectTypes = null)
  21. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByColorLeft($value, $limit = 0, $offset = 0, $objectTypes = null)
  22. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByColorRight($value, $limit = 0, $offset = 0, $objectTypes = null)
  23. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  24. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getBySnippet($value, $limit = 0, $offset = 0, $objectTypes = null)
  25. * @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByBtnText($value, $limit = 0, $offset = 0, $objectTypes = null)
  26. */
  27. class Teaser extends Concrete
  28. {
  29. protected $o_classId = "Teaser";
  30. protected $o_className = "Teaser";
  31. protected $Title;
  32. protected $text;
  33. protected $colorLeft;
  34. protected $colorRight;
  35. protected $Image;
  36. protected $snippet;
  37. protected $btnText;
  38. /**
  39. * @param array $values
  40. * @return \Pimcore\Model\DataObject\Teaser
  41. */
  42. public static function create($values = array()) {
  43.     $object = new static();
  44.     $object->setValues($values);
  45.     return $object;
  46. }
  47. /**
  48. * Get Title - Überschrift
  49. * @return string|null
  50. */
  51. public function getTitle(): ?string
  52. {
  53.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  54.         $preValue = $this->preGetValue("Title");
  55.         if ($preValue !== null) {
  56.             return $preValue;
  57.         }
  58.     }
  59.     $data = $this->Title;
  60.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  61.         return $data->getPlain();
  62.     }
  63.     return $data;
  64. }
  65. /**
  66. * Set Title - Überschrift
  67. * @param string|null $Title
  68. * @return \Pimcore\Model\DataObject\Teaser
  69. */
  70. public function setTitle(?string $Title)
  71. {
  72.     $this->Title = $Title;
  73.     return $this;
  74. }
  75. /**
  76. * Get text - Einleitung
  77. * @return string|null
  78. */
  79. public function getText(): ?string
  80. {
  81.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  82.         $preValue = $this->preGetValue("text");
  83.         if ($preValue !== null) {
  84.             return $preValue;
  85.         }
  86.     }
  87.     $data = $this->text;
  88.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  89.         return $data->getPlain();
  90.     }
  91.     return $data;
  92. }
  93. /**
  94. * Set text - Einleitung
  95. * @param string|null $text
  96. * @return \Pimcore\Model\DataObject\Teaser
  97. */
  98. public function setText(?string $text)
  99. {
  100.     $this->text = $text;
  101.     return $this;
  102. }
  103. /**
  104. * Get colorLeft - Farbe Links
  105. * @return string|null
  106. */
  107. public function getColorLeft(): ?string
  108. {
  109.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  110.         $preValue = $this->preGetValue("colorLeft");
  111.         if ($preValue !== null) {
  112.             return $preValue;
  113.         }
  114.     }
  115.     $data = $this->colorLeft;
  116.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  117.         return $data->getPlain();
  118.     }
  119.     return $data;
  120. }
  121. /**
  122. * Set colorLeft - Farbe Links
  123. * @param string|null $colorLeft
  124. * @return \Pimcore\Model\DataObject\Teaser
  125. */
  126. public function setColorLeft(?string $colorLeft)
  127. {
  128.     $this->colorLeft = $colorLeft;
  129.     return $this;
  130. }
  131. /**
  132. * Get colorRight - Farbe Rechts
  133. * @return string|null
  134. */
  135. public function getColorRight(): ?string
  136. {
  137.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  138.         $preValue = $this->preGetValue("colorRight");
  139.         if ($preValue !== null) {
  140.             return $preValue;
  141.         }
  142.     }
  143.     $data = $this->colorRight;
  144.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  145.         return $data->getPlain();
  146.     }
  147.     return $data;
  148. }
  149. /**
  150. * Set colorRight - Farbe Rechts
  151. * @param string|null $colorRight
  152. * @return \Pimcore\Model\DataObject\Teaser
  153. */
  154. public function setColorRight(?string $colorRight)
  155. {
  156.     $this->colorRight = $colorRight;
  157.     return $this;
  158. }
  159. /**
  160. * Get Image - Image
  161. * @return \Pimcore\Model\Asset\Image|null
  162. */
  163. public function getImage(): ?\Pimcore\Model\Asset\Image
  164. {
  165.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  166.         $preValue = $this->preGetValue("Image");
  167.         if ($preValue !== null) {
  168.             return $preValue;
  169.         }
  170.     }
  171.     $data = $this->Image;
  172.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  173.         return $data->getPlain();
  174.     }
  175.     return $data;
  176. }
  177. /**
  178. * Set Image - Image
  179. * @param \Pimcore\Model\Asset\Image|null $Image
  180. * @return \Pimcore\Model\DataObject\Teaser
  181. */
  182. public function setImage(?\Pimcore\Model\Asset\Image $Image)
  183. {
  184.     $this->Image = $Image;
  185.     return $this;
  186. }
  187. /**
  188. * Get snippet - snippet
  189. * @return \Pimcore\Model\Document\Snippet|null
  190. */
  191. public function getSnippet(): ?\Pimcore\Model\Element\AbstractElement
  192. {
  193.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  194.         $preValue = $this->preGetValue("snippet");
  195.         if ($preValue !== null) {
  196.             return $preValue;
  197.         }
  198.     }
  199.     $data = $this->getClass()->getFieldDefinition("snippet")->preGetData($this);
  200.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  201.         return $data->getPlain();
  202.     }
  203.     return $data;
  204. }
  205. /**
  206. * Set snippet - snippet
  207. * @param \Pimcore\Model\Document\Snippet $snippet
  208. * @return \Pimcore\Model\DataObject\Teaser
  209. */
  210. public function setSnippet(?\Pimcore\Model\Element\AbstractElement $snippet)
  211. {
  212.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  213.     $fd = $this->getClass()->getFieldDefinition("snippet");
  214.     $hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  215.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  216.     $currentData = $this->getSnippet();
  217.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  218.     $isEqual = $fd->isEqual($currentData, $snippet);
  219.     if (!$isEqual) {
  220.         $this->markFieldDirty("snippet", true);
  221.     }
  222.     $this->snippet = $fd->preSetData($this, $snippet);
  223.     return $this;
  224. }
  225. /**
  226. * Get btnText - Button
  227. * @return string|null
  228. */
  229. public function getBtnText(): ?string
  230. {
  231.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  232.         $preValue = $this->preGetValue("btnText");
  233.         if ($preValue !== null) {
  234.             return $preValue;
  235.         }
  236.     }
  237.     $data = $this->btnText;
  238.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  239.         return $data->getPlain();
  240.     }
  241.     return $data;
  242. }
  243. /**
  244. * Set btnText - Button
  245. * @param string|null $btnText
  246. * @return \Pimcore\Model\DataObject\Teaser
  247. */
  248. public function setBtnText(?string $btnText)
  249. {
  250.     $this->btnText = $btnText;
  251.     return $this;
  252. }
  253. }