<?php
/**
* Inheritance: no
* Variants: no
Fields Summary:
- image [image]
- localizedfields [localizedfields]
-- title [input]
-- text [textarea]
-- link [link]
*/
namespace Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
use Pimcore\Model\DataObject\PreGetValueHookInterface;
/**
* @method static \Pimcore\Model\DataObject\Teaser\Listing getList()
* @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByText($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Teaser\Listing|\Pimcore\Model\DataObject\Teaser|null getByLink($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
*/
class Teaser extends Concrete
{
protected $o_classId = "1";
protected $o_className = "Teaser";
protected $image;
protected $localizedfields;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\Teaser
*/
public static function create($values = array()) {
$object = new static();
$object->setValues($values);
return $object;
}
/**
* Get image - Bild
* @return \Pimcore\Model\Asset\Image|null
*/
public function getImage()
{
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 - Bild
* @param \Pimcore\Model\Asset\Image|null $image
* @return \Pimcore\Model\DataObject\Teaser
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
/**
* Get localizedfields -
* @return \Pimcore\Model\DataObject\Localizedfield|null
*/
public function getLocalizedfields()
{
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)
{
$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 text - Text
* @return string|null
*/
public function getText($language = null)
{
$data = $this->getLocalizedfields()->getLocalizedValue("text", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("text");
if ($preValue !== null) {
return $preValue;
}
}
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Get link - Link
* @return \Pimcore\Model\DataObject\Data\Link|null
*/
public function getLink($language = null)
{
$data = $this->getLocalizedfields()->getLocalizedValue("link", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("link");
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\Teaser
*/
public function setLocalizedfields($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\Teaser
*/
public function setTitle ($title, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("title", $title, $language, !$isEqual);
return $this;
}
/**
* Set text - Text
* @param string|null $text
* @return \Pimcore\Model\DataObject\Teaser
*/
public function setText ($text, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("text", $text, $language, !$isEqual);
return $this;
}
/**
* Set link - Link
* @param \Pimcore\Model\DataObject\Data\Link|null $link
* @return \Pimcore\Model\DataObject\Teaser
*/
public function setLink ($link, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("link", $link, $language, !$isEqual);
return $this;
}
}