var/classes/DataObject/Card.php line 26

Open in your IDE?
  1. <?php
  2. /**
  3. * Inheritance: no
  4. * Variants: no
  5. *
  6. * Fields Summary:
  7. * - image [image]
  8. * - headline [wysiwyg]
  9. * - text [wysiwyg]
  10. * - link [link]
  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\Card\Listing getList(array $config = [])
  17. * @method static \Pimcore\Model\DataObject\Card\Listing|\Pimcore\Model\DataObject\Card|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  18. * @method static \Pimcore\Model\DataObject\Card\Listing|\Pimcore\Model\DataObject\Card|null getByHeadline($value, $limit = 0, $offset = 0, $objectTypes = null)
  19. * @method static \Pimcore\Model\DataObject\Card\Listing|\Pimcore\Model\DataObject\Card|null getByText($value, $limit = 0, $offset = 0, $objectTypes = null)
  20. */
  21. class Card extends Concrete
  22. {
  23. protected $o_classId = "MuldenContainer";
  24. protected $o_className = "Card";
  25. protected $image;
  26. protected $headline;
  27. protected $text;
  28. protected $link;
  29. /**
  30. * @param array $values
  31. * @return \Pimcore\Model\DataObject\Card
  32. */
  33. public static function create($values = array()) {
  34. $object = new static();
  35. $object->setValues($values);
  36. return $object;
  37. }
  38. /**
  39. * Get image - Image
  40. * @return \Pimcore\Model\Asset\Image|null
  41. */
  42. public function getImage(): ?\Pimcore\Model\Asset\Image
  43. {
  44. if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  45. $preValue = $this->preGetValue("image");
  46. if ($preValue !== null) {
  47. return $preValue;
  48. }
  49. }
  50. $data = $this->image;
  51. if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  52. return $data->getPlain();
  53. }
  54. return $data;
  55. }
  56. /**
  57. * Set image - Image
  58. * @param \Pimcore\Model\Asset\Image|null $image
  59. * @return \Pimcore\Model\DataObject\Card
  60. */
  61. public function setImage(?\Pimcore\Model\Asset\Image $image)
  62. {
  63. $this->image = $image;
  64. return $this;
  65. }
  66. /**
  67. * Get headline - Headline
  68. * @return string|null
  69. */
  70. public function getHeadline(): ?string
  71. {
  72. if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  73. $preValue = $this->preGetValue("headline");
  74. if ($preValue !== null) {
  75. return $preValue;
  76. }
  77. }
  78. $data = $this->getClass()->getFieldDefinition("headline")->preGetData($this);
  79. if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  80. return $data->getPlain();
  81. }
  82. return $data;
  83. }
  84. /**
  85. * Set headline - Headline
  86. * @param string|null $headline
  87. * @return \Pimcore\Model\DataObject\Card
  88. */
  89. public function setHeadline(?string $headline)
  90. {
  91. $this->headline = $headline;
  92. return $this;
  93. }
  94. /**
  95. * Get text - Text
  96. * @return string|null
  97. */
  98. public function getText(): ?string
  99. {
  100. if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  101. $preValue = $this->preGetValue("text");
  102. if ($preValue !== null) {
  103. return $preValue;
  104. }
  105. }
  106. $data = $this->getClass()->getFieldDefinition("text")->preGetData($this);
  107. if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  108. return $data->getPlain();
  109. }
  110. return $data;
  111. }
  112. /**
  113. * Set text - Text
  114. * @param string|null $text
  115. * @return \Pimcore\Model\DataObject\Card
  116. */
  117. public function setText(?string $text)
  118. {
  119. $this->text = $text;
  120. return $this;
  121. }
  122. /**
  123. * Get link - Link
  124. * @return \Pimcore\Model\DataObject\Data\Link|null
  125. */
  126. public function getLink(): ?\Pimcore\Model\DataObject\Data\Link
  127. {
  128. if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  129. $preValue = $this->preGetValue("link");
  130. if ($preValue !== null) {
  131. return $preValue;
  132. }
  133. }
  134. $data = $this->link;
  135. if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  136. return $data->getPlain();
  137. }
  138. return $data;
  139. }
  140. /**
  141. * Set link - Link
  142. * @param \Pimcore\Model\DataObject\Data\Link|null $link
  143. * @return \Pimcore\Model\DataObject\Card
  144. */
  145. public function setLink(?\Pimcore\Model\DataObject\Data\Link $link)
  146. {
  147. $this->link = $link;
  148. return $this;
  149. }
  150. }