<?php
/**
* Inheritance: no
* Variants: no
*
* Fields Summary:
* - localizedfields [localizedfields]
* -- text [wysiwyg]
* -- link [link]
* - icon [select]
*/
namespace Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
use Pimcore\Model\DataObject\PreGetValueHookInterface;
/**
* @method static \Pimcore\Model\DataObject\IconTeaser\Listing getList(array $config = [])
* @method static \Pimcore\Model\DataObject\IconTeaser\Listing|\Pimcore\Model\DataObject\IconTeaser|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\IconTeaser\Listing|\Pimcore\Model\DataObject\IconTeaser|null getByText($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\IconTeaser\Listing|\Pimcore\Model\DataObject\IconTeaser|null getByLink($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\IconTeaser\Listing|\Pimcore\Model\DataObject\IconTeaser|null getByIcon($value, $limit = 0, $offset = 0, $objectTypes = null)
*/
class IconTeaser extends Concrete
{
protected $o_classId = "1";
protected $o_className = "IconTeaser";
protected $localizedfields;
protected $icon;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\IconTeaser
*/
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()
{
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 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\IconTeaser
*/
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 text - Text
* @param string|null $text
* @return \Pimcore\Model\DataObject\IconTeaser
*/
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\IconTeaser
*/
public function setLink ($link, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("link", $link, $language, !$isEqual);
return $this;
}
/**
* Get icon - Icon
* @return string|null
*/
public function getIcon()
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("icon");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->icon;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set icon - Icon
* @param string|null $icon
* @return \Pimcore\Model\DataObject\IconTeaser
*/
public function setIcon($icon)
{
$this->icon = $icon;
return $this;
}
}