var/classes/DataObject/FAQ.php line 25

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - localizedfields [localizedfields]
  8.  * -- question [textarea]
  9.  * -- answer [wysiwyg]
  10.  */
  11. namespace Pimcore\Model\DataObject;
  12. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  13. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  14. /**
  15. * @method static \Pimcore\Model\DataObject\FAQ\Listing getList(array $config = [])
  16. * @method static \Pimcore\Model\DataObject\FAQ\Listing|\Pimcore\Model\DataObject\FAQ|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  17. * @method static \Pimcore\Model\DataObject\FAQ\Listing|\Pimcore\Model\DataObject\FAQ|null getByQuestion($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  18. * @method static \Pimcore\Model\DataObject\FAQ\Listing|\Pimcore\Model\DataObject\FAQ|null getByAnswer($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  19. */
  20. class FAQ extends Concrete
  21. {
  22. protected $o_classId "7";
  23. protected $o_className "FAQ";
  24. protected $localizedfields;
  25. /**
  26. * @param array $values
  27. * @return \Pimcore\Model\DataObject\FAQ
  28. */
  29. public static function create($values = array()) {
  30.     $object = new static();
  31.     $object->setValues($values);
  32.     return $object;
  33. }
  34. /**
  35. * Get localizedfields - Vertaalbare velden
  36. * @return \Pimcore\Model\DataObject\Localizedfield|null
  37. */
  38. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  39. {
  40.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  41.         $preValue $this->preGetValue("localizedfields");
  42.         if ($preValue !== null) {
  43.             return $preValue;
  44.         }
  45.     }
  46.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  47.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  48.         return $data->getPlain();
  49.     }
  50.     return $data;
  51. }
  52. /**
  53. * Get question - Vraag
  54. * @return string|null
  55. */
  56. public function getQuestion($language null): ?string
  57. {
  58.     $data $this->getLocalizedfields()->getLocalizedValue("question"$language);
  59.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  60.         $preValue $this->preGetValue("question");
  61.         if ($preValue !== null) {
  62.             return $preValue;
  63.         }
  64.     }
  65.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  66.         return $data->getPlain();
  67.     }
  68.     return $data;
  69. }
  70. /**
  71. * Get answer - Antwoord
  72. * @return string|null
  73. */
  74. public function getAnswer($language null): ?string
  75. {
  76.     $data $this->getLocalizedfields()->getLocalizedValue("answer"$language);
  77.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  78.         $preValue $this->preGetValue("answer");
  79.         if ($preValue !== null) {
  80.             return $preValue;
  81.         }
  82.     }
  83.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  84.         return $data->getPlain();
  85.     }
  86.     return $data;
  87. }
  88. /**
  89. * Set localizedfields - Vertaalbare velden
  90. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  91. * @return \Pimcore\Model\DataObject\FAQ
  92. */
  93. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  94. {
  95.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  96.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  97.     $currentData $this->getLocalizedfields();
  98.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  99.     $this->markFieldDirty("localizedfields"true);
  100.     $this->localizedfields $localizedfields;
  101.     return $this;
  102. }
  103. /**
  104. * Set question - Vraag
  105. * @param string|null $question
  106. * @return \Pimcore\Model\DataObject\FAQ
  107. */
  108. public function setQuestion (?string $question$language null)
  109. {
  110.     $isEqual false;
  111.     $this->getLocalizedfields()->setLocalizedValue("question"$question$language, !$isEqual);
  112.     return $this;
  113. }
  114. /**
  115. * Set answer - Antwoord
  116. * @param string|null $answer
  117. * @return \Pimcore\Model\DataObject\FAQ
  118. */
  119. public function setAnswer (?string $answer$language null)
  120. {
  121.     $isEqual false;
  122.     $this->getLocalizedfields()->setLocalizedValue("answer"$answer$language, !$isEqual);
  123.     return $this;
  124. }
  125. }