• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/kanban.php
  • Класс: Bitrix\Crm\Kanban
  • Вызов: Kanban::__construct
protected function __construct(string $entityType, array $params = [])
{
	Loc::loadLanguageFile(__FILE__);
	$this->entityType = $entityType;
	$this->viewMode = $params['VIEW_MODE'] ?? ViewMode::MODE_STAGES;

	$type = mb_strtoupper($this->entityType);
	$this->entity = Entity::getInstance($type, $this->viewMode);

	if(!$this->entity)
	{
		throw new EntityNotFoundException('Entity not found by type: ' . $entityType);
	}

	$this->params = $params;

	$categoryId = (isset($this->params['CATEGORY_ID']) ? (int)$this->params['CATEGORY_ID'] : null);
	$this->setCategoryId($categoryId);
	$this->setNameTemplate($this->params['NAME_TEMPLATE'] ?? null);

	$this->entity->setCanEditCommonSettings($this->canEditSettings());

	$this->currency = $this->entity->getCurrency();
	$this->statusKey = $this->entity->getStageFieldName();

	//additional select-edit fields
	$this->additionalSelect = $this->entity->getAdditionalSelectFields();
	$this->additionalEdit = $this->entity->getAdditionalEditFields();

	$this->currentUserId = Container::getInstance()->getContext()->getUserId();

	//redefine price-field
	if ($this->entity->isCustomPriceFieldsSupported())
	{
		$this->fieldSum = ($this->entity->getCustomPriceFieldName() ?? '');
	}

	if (!isset($this->params['ONLY_COLUMNS']) || $this->params['ONLY_COLUMNS'] !== 'Y')
	{
		$this->requiredFields = $this->entity->getRequiredFieldsByStages($this->getStatuses());
	}
}