<?php
/**
* Inheritance: no
* Variants: no
*
* Fields Summary:
* - icon [select]
* - localizedfields [localizedfields]
* -- headline [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\Iconbox\Listing getList(array $config = [])
* @method static \Pimcore\Model\DataObject\Iconbox\Listing|\Pimcore\Model\DataObject\Iconbox|null getByIcon($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Iconbox\Listing|\Pimcore\Model\DataObject\Iconbox|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Iconbox\Listing|\Pimcore\Model\DataObject\Iconbox|null getByHeadline($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Iconbox\Listing|\Pimcore\Model\DataObject\Iconbox|null getByText($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\Iconbox\Listing|\Pimcore\Model\DataObject\Iconbox|null getByLink($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
*/
class Iconbox extends Concrete
{
protected $o_classId = "CNICONBOX";
protected $o_className = "Iconbox";
protected $icon;
protected $localizedfields;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\Iconbox
*/
public static function create($values = array()) {
$object = new static();
$object->setValues($values);
return $object;
}
/**
* Get icon - Icon
* @return string|null
*/
public function getIcon(): ?string
{
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\Iconbox
*/
public function setIcon(?string $icon)
{
$this->icon = $icon;
return $this;
}
/**
* 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 headline - Überschrift
* @return string|null
*/
public function getHeadline($language = null): ?string
{
$data = $this->getLocalizedfields()->getLocalizedValue("headline", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("headline");
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): ?string
{
$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): ?\Pimcore\Model\DataObject\Data\Link
{
$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\Iconbox
*/
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 headline - Überschrift
* @param string|null $headline
* @return \Pimcore\Model\DataObject\Iconbox
*/
public function setHeadline (?string $headline, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("headline", $headline, $language, !$isEqual);
return $this;
}
/**
* Set text - Text
* @param string|null $text
* @return \Pimcore\Model\DataObject\Iconbox
*/
public function setText (?string $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\Iconbox
*/
public function setLink (?\Pimcore\Model\DataObject\Data\Link $link, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("link", $link, $language, !$isEqual);
return $this;
}
}