<?php
/**
* Inheritance: no
* Variants: no
*
* Fields Summary:
* - title [input]
* - content [wysiwyg]
* - image [image]
* - page [manyToOneRelation]
*/
namespace Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
use Pimcore\Model\DataObject\PreGetValueHookInterface;
/**
* @method static \Pimcore\Model\DataObject\CarouselSlide\Listing getList(array $config = [])
* @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByTitle($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByContent($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\CarouselSlide\Listing|\Pimcore\Model\DataObject\CarouselSlide|null getByPage($value, $limit = 0, $offset = 0, $objectTypes = null)
*/
class CarouselSlide extends Concrete
{
protected $o_classId = "2";
protected $o_className = "CarouselSlide";
protected $title;
protected $content;
protected $image;
protected $page;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\CarouselSlide
*/
public static function create($values = array()) {
$object = new static();
$object->setValues($values);
return $object;
}
/**
* Get title - Titel
* @return string|null
*/
public function getTitle(): ?string
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("title");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->title;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set title - Titel
* @param string|null $title
* @return \Pimcore\Model\DataObject\CarouselSlide
*/
public function setTitle(?string $title)
{
$this->title = $title;
return $this;
}
/**
* Get content - Inhoud
* @return string|null
*/
public function getContent(): ?string
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("content");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("content")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set content - Inhoud
* @param string|null $content
* @return \Pimcore\Model\DataObject\CarouselSlide
*/
public function setContent(?string $content)
{
$this->content = $content;
return $this;
}
/**
* Get image - Afbeelding
* @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 - Afbeelding
* @param \Pimcore\Model\Asset\Image|null $image
* @return \Pimcore\Model\DataObject\CarouselSlide
*/
public function setImage(?\Pimcore\Model\Asset\Image $image)
{
$this->image = $image;
return $this;
}
/**
* Get page - Pagina
* @return \Pimcore\Model\Document\Page|null
*/
public function getPage(): ?\Pimcore\Model\Element\AbstractElement
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("page");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("page")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set page - Pagina
* @param \Pimcore\Model\Document\Page|null $page
* @return \Pimcore\Model\DataObject\CarouselSlide
*/
public function setPage(?\Pimcore\Model\Element\AbstractElement $page)
{
/** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
$fd = $this->getClass()->getFieldDefinition("page");
$hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
$currentData = $this->getPage();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
$isEqual = $fd->isEqual($currentData, $page);
if (!$isEqual) {
$this->markFieldDirty("page", true);
}
$this->page = $fd->preSetData($this, $page);
return $this;
}
}