config/pimcore/classes/DataObject/USP.php line 29

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - icon [select]
  8.  * - localizedfields [localizedfields]
  9.  * -- textBold [select]
  10.  * -- title [input]
  11.  * -- subTitle [input]
  12.  */
  13. namespace Pimcore\Model\DataObject;
  14. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  15. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  16. /**
  17. * @method static \Pimcore\Model\DataObject\USP\Listing getList(array $config = [])
  18. * @method static \Pimcore\Model\DataObject\USP\Listing|\Pimcore\Model\DataObject\USP|null getByIcon($value, $limit = 0, $offset = 0, $objectTypes = null)
  19. * @method static \Pimcore\Model\DataObject\USP\Listing|\Pimcore\Model\DataObject\USP|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  20. * @method static \Pimcore\Model\DataObject\USP\Listing|\Pimcore\Model\DataObject\USP|null getByTextBold($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  21. * @method static \Pimcore\Model\DataObject\USP\Listing|\Pimcore\Model\DataObject\USP|null getByTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  22. * @method static \Pimcore\Model\DataObject\USP\Listing|\Pimcore\Model\DataObject\USP|null getBySubTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  23. */
  24. class USP extends Concrete
  25. {
  26. protected $o_classId "USP";
  27. protected $o_className "USP";
  28. protected $icon;
  29. protected $localizedfields;
  30. /**
  31. * @param array $values
  32. * @return \Pimcore\Model\DataObject\USP
  33. */
  34. public static function create($values = array()) {
  35.     $object = new static();
  36.     $object->setValues($values);
  37.     return $object;
  38. }
  39. /**
  40. * Get icon - Icon
  41. * @return string|null
  42. */
  43. public function getIcon(): ?string
  44. {
  45.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  46.         $preValue $this->preGetValue("icon");
  47.         if ($preValue !== null) {
  48.             return $preValue;
  49.         }
  50.     }
  51.     $data $this->icon;
  52.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  53.         return $data->getPlain();
  54.     }
  55.     return $data;
  56. }
  57. /**
  58. * Set icon - Icon
  59. * @param string|null $icon
  60. * @return \Pimcore\Model\DataObject\USP
  61. */
  62. public function setIcon(?string $icon)
  63. {
  64.     $this->icon $icon;
  65.     return $this;
  66. }
  67. /**
  68. * Get localizedfields - 
  69. * @return \Pimcore\Model\DataObject\Localizedfield|null
  70. */
  71. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  72. {
  73.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  74.         $preValue $this->preGetValue("localizedfields");
  75.         if ($preValue !== null) {
  76.             return $preValue;
  77.         }
  78.     }
  79.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  80.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  81.         return $data->getPlain();
  82.     }
  83.     return $data;
  84. }
  85. /**
  86. * Get textBold - Bold
  87. * @return string|null
  88. */
  89. public function getTextBold($language null): ?string
  90. {
  91.     $data $this->getLocalizedfields()->getLocalizedValue("textBold"$language);
  92.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  93.         $preValue $this->preGetValue("textBold");
  94.         if ($preValue !== null) {
  95.             return $preValue;
  96.         }
  97.     }
  98.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  99.         return $data->getPlain();
  100.     }
  101.     return $data;
  102. }
  103. /**
  104. * Get title - Title
  105. * @return string|null
  106. */
  107. public function getTitle($language null): ?string
  108. {
  109.     $data $this->getLocalizedfields()->getLocalizedValue("title"$language);
  110.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  111.         $preValue $this->preGetValue("title");
  112.         if ($preValue !== null) {
  113.             return $preValue;
  114.         }
  115.     }
  116.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  117.         return $data->getPlain();
  118.     }
  119.     return $data;
  120. }
  121. /**
  122. * Get subTitle - Subtitle
  123. * @return string|null
  124. */
  125. public function getSubTitle($language null): ?string
  126. {
  127.     $data $this->getLocalizedfields()->getLocalizedValue("subTitle"$language);
  128.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  129.         $preValue $this->preGetValue("subTitle");
  130.         if ($preValue !== null) {
  131.             return $preValue;
  132.         }
  133.     }
  134.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  135.         return $data->getPlain();
  136.     }
  137.     return $data;
  138. }
  139. /**
  140. * Set localizedfields - 
  141. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  142. * @return \Pimcore\Model\DataObject\USP
  143. */
  144. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  145. {
  146.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  147.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  148.     $currentData $this->getLocalizedfields();
  149.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  150.     $this->markFieldDirty("localizedfields"true);
  151.     $this->localizedfields $localizedfields;
  152.     return $this;
  153. }
  154. /**
  155. * Set textBold - Bold
  156. * @param string|null $textBold
  157. * @return \Pimcore\Model\DataObject\USP
  158. */
  159. public function setTextBold (?string $textBold$language null)
  160. {
  161.     $isEqual false;
  162.     $this->getLocalizedfields()->setLocalizedValue("textBold"$textBold$language, !$isEqual);
  163.     return $this;
  164. }
  165. /**
  166. * Set title - Title
  167. * @param string|null $title
  168. * @return \Pimcore\Model\DataObject\USP
  169. */
  170. public function setTitle (?string $title$language null)
  171. {
  172.     $isEqual false;
  173.     $this->getLocalizedfields()->setLocalizedValue("title"$title$language, !$isEqual);
  174.     return $this;
  175. }
  176. /**
  177. * Set subTitle - Subtitle
  178. * @param string|null $subTitle
  179. * @return \Pimcore\Model\DataObject\USP
  180. */
  181. public function setSubTitle (?string $subTitle$language null)
  182. {
  183.     $isEqual false;
  184.     $this->getLocalizedfields()->setLocalizedValue("subTitle"$subTitle$language, !$isEqual);
  185.     return $this;
  186. }
  187. }