• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Configurable.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Configurable
  • Вызов: Configurable::addPinMenuItems
protected function addPinMenuItems(array &$menuItems): void
{
	$canBeFixed =
		$this->isPinnable()
		&& !$this->getModel()->isScheduled()
		&& !$this->getModel()->isFixed()
	;

	$canBeUnFixed =
		$this->isPinnable()
		&& !$this->getModel()->isScheduled()
		&& $this->getModel()->isFixed()
	;

	if (!$canBeFixed && !$canBeUnFixed)
	{
		return;
	}

	if ($canBeFixed)
	{
		$menuItems['pin'] = (new MenuItem(Loc::getMessage('CRM_TIMELINE_MENU_FASTEN')))
			->setHideIfReadonly()
			->setSort(9900)
			->setAction(
				(new RunAjaxAction('crm.timeline.item.pin'))
					->addActionParamInt('id', $this->getModel()->getId())
					->addActionParamInt('ownerTypeId', $this->getContext()->getEntityTypeId())
					->addActionParamInt('ownerId', $this->getContext()->getEntityId())
			)
		;
	}
	if ($canBeUnFixed)
	{
		$menuItems['unpin'] = (new MenuItem(Loc::getMessage('CRM_TIMELINE_MENU_UNFASTEN')))
			->setHideIfReadonly()
			->setSort(9900)
			->setAction($this->getUnpinAction())
		;
	}
}