Task::getEditAction

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Task
  4. getEditAction
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/tasks/task.php
  • Класс: Bitrix\Crm\Activity\Provider\Tasks\Task
  • Вызов: Task::getEditAction
public function getEditAction(int $activityId, int $userId = 0): string
{
	if (!Loader::includeModule('tasks'))
	{
		return '';
	}

	$query = ActivityTable::query();
	$query
		->setSelect(['ID', 'ASSOCIATED_ENTITY_ID'])
		->where('ID', $activityId)
	;

	$activity = $query->exec()->fetchObject();
	if (is_null($activity))
	{
		return '';
	}

	$taskId = $activity->getAssociatedEntityId();
	if (is_null($taskId))
	{
		return '';
	}

	$factory = TaskSliderFactory::getFactory();
	if (is_null($factory))
	{
		return '';
	}

	$factory
		->setAction($factory::EDIT_ACTION)
		->skipEvents()
	;
	$slider = $factory->createEntitySlider(
		$taskId,
		$factory::TASK,
		$userId,
		$factory::PERSONAL_CONTEXT
	);

	return $slider->getJs();
}

Добавить комментарий