<?php
/**
* Inheritance: no
* Variants: no
*
* Fields Summary:
* - localizedfields [localizedfields]
* -- title [input]
* -- subtitle [input]
* -- description [wysiwyg]
* - image [image]
* - relation [manyToOneRelation]
* - directpagelink [checkbox]
* - images [imageGallery]
*/
namespace Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
use Pimcore\Model\DataObject\PreGetValueHookInterface;
/**
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing getList(array $config = [])
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getByTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getBySubtitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getByDescription($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getByRelation($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaseritem\Listing|\Pimcore\Model\DataObject\Teaseritem|null getByDirectpagelink($value, $limit = 0, $offset = 0, $objectTypes = null)
*/
class Teaseritem extends Concrete
{
protected $o_classId = "TEASERITEM";
protected $o_className = "Teaseritem";
protected $localizedfields;
protected $image;
protected $relation;
protected $directpagelink;
protected $images;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public static function create($values = array()) {
$object = new static();
$object->setValues($values);
return $object;
}
/**
* Get localizedfields -
* @return \Pimcore\Model\DataObject\Localizedfield|null
*/
public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("localizedfields");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Get title - Titel
* @return string|null
*/
public function getTitle($language = null): ?string
{
$data = $this->getLocalizedfields()->getLocalizedValue("title", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("title");
if ($preValue !== null) {
return $preValue;
}
}
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Get subtitle - Untertitel
* @return string|null
*/
public function getSubtitle($language = null): ?string
{
$data = $this->getLocalizedfields()->getLocalizedValue("subtitle", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("subtitle");
if ($preValue !== null) {
return $preValue;
}
}
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Get description - Beschreibung
* @return string|null
*/
public function getDescription($language = null): ?string
{
$data = $this->getLocalizedfields()->getLocalizedValue("description", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("description");
if ($preValue !== null) {
return $preValue;
}
}
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set localizedfields -
* @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
{
$hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
$currentData = $this->getLocalizedfields();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
$this->markFieldDirty("localizedfields", true);
$this->localizedfields = $localizedfields;
return $this;
}
/**
* Set title - Titel
* @param string|null $title
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setTitle (?string $title, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("title", $title, $language, !$isEqual);
return $this;
}
/**
* Set subtitle - Untertitel
* @param string|null $subtitle
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setSubtitle (?string $subtitle, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("subtitle", $subtitle, $language, !$isEqual);
return $this;
}
/**
* Set description - Beschreibung
* @param string|null $description
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setDescription (?string $description, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("description", $description, $language, !$isEqual);
return $this;
}
/**
* Get image - Vorschaubild
* @return \Pimcore\Model\Asset\Image|null
*/
public function getImage(): ?\Pimcore\Model\Asset\Image
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("image");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->image;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set image - Vorschaubild
* @param \Pimcore\Model\Asset\Image|null $image
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setImage(?\Pimcore\Model\Asset\Image $image)
{
$this->image = $image;
return $this;
}
/**
* Get relation - Referenzobjekt
* @return \Pimcore\Model\Document\Page | \Pimcore\Model\Document\Snippet | \Pimcore\Model\Document | \Pimcore\Model\DataObject\AbstractObject|null
*/
public function getRelation(): ?\Pimcore\Model\Element\AbstractElement
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("relation");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("relation")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set relation - Referenzobjekt
* @param \Pimcore\Model\Document\Page | \Pimcore\Model\Document\Snippet | \Pimcore\Model\Document | \Pimcore\Model\DataObject\AbstractObject|null $relation
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setRelation(?\Pimcore\Model\Element\AbstractElement $relation)
{
/** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
$fd = $this->getClass()->getFieldDefinition("relation");
$hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
$currentData = $this->getRelation();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
$isEqual = $fd->isEqual($currentData, $relation);
if (!$isEqual) {
$this->markFieldDirty("relation", true);
}
$this->relation = $fd->preSetData($this, $relation);
return $this;
}
/**
* Get directpagelink - Direct Page Link
* @return bool|null
*/
public function getDirectpagelink(): ?bool
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("directpagelink");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->directpagelink;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set directpagelink - Direct Page Link
* @param bool|null $directpagelink
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setDirectpagelink(?bool $directpagelink)
{
$this->directpagelink = $directpagelink;
return $this;
}
/**
* Get images - Weitere Bilder
* @return \Pimcore\Model\DataObject\Data\ImageGallery|null
*/
public function getImages(): ?\Pimcore\Model\DataObject\Data\ImageGallery
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("images");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->images;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set images - Weitere Bilder
* @param \Pimcore\Model\DataObject\Data\ImageGallery|null $images
* @return \Pimcore\Model\DataObject\Teaseritem
*/
public function setImages(?\Pimcore\Model\DataObject\Data\ImageGallery $images)
{
$this->images = $images;
return $this;
}
}