- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/component/itemlist.php
- Класс: Bitrix\Crm\Component\ItemList
- Вызов: ItemList::getAddButtonParameters
protected function getAddButtonParameters(bool $isDisabled = false): array
{
$link = Service\Container::getInstance()->getRouter()
->getItemDetailUrl(
$this->entityTypeId,
0,
$this->getCategoryId()
)
->getUri()
;
// disabled button configuration
$disabledButtonDataset = [];
$disabledButtonClass = '';
if($isDisabled)
{
$link = null;
$hintMsg = $this->entityTypeId === \CCrmOwnerType::SmartInvoice
? 'CRM_SMART_INVOICE_ADD_HINT'
: 'CRM_TYPE_ITEM_ADD_HINT';
$disabledButtonDataset = [
'hint' => Loc::getMessage($hintMsg),
'hint-no-icon' => '',
];
$disabledButtonClass = 'ui-btn-disabled-ex'; // to correct display hint
}
$buttonTitle = Loc::getMessage('CRM_COMMON_ACTION_CREATE_' . $this->entityTypeId);
if (!$buttonTitle)
{
$buttonTitle = Loc::getMessage('CRM_COMMON_ACTION_CREATE');
}
return [
'color' => Buttons\Color::SUCCESS,
'text' => $buttonTitle,
'link' => $link,
'dataset' => $disabledButtonDataset,
'className' => $disabledButtonClass,
];
}