Current Path : /var/www/axolotl/data/www/yar.axolotls.ru/bitrix/modules/salescenter/lib/fields/ |
Current File : /var/www/axolotl/data/www/yar.axolotls.ru/bitrix/modules/salescenter/lib/fields/field.php |
<?php namespace Bitrix\SalesCenter\Fields; class Field { protected $name; protected $title; protected $entity; public function __construct(string $name, array $params = []) { $this->name = $name; if($params['title'] && is_string($params['title'])) { $this->title = $params['title']; } if($params['entity'] && $params['entity'] instanceof Entity) { $this->setEntity($params['entity']); } } public function getName(): string { return $this->name; } public function getTitle(): string { if(!empty($this->title)) { return $this->title; } elseif($this->getEntity()) { return $this->getEntity()->getName(); } return $this->name; } public function setTitle(string $title): Field { $this->title = $title; return $this; } public function getEntity(): ?Entity { return $this->entity; } public function setEntity(Entity $entity): Field { $this->entity = $entity; return $this; } }