• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/ui/webpack/button.php
  • Класс: Bitrix\Crm\UI\Webpack\Button
  • Вызов: Button::getWidgets
public function getWidgets()
{
	if ($this->widgets !== null)
	{
		return $this->widgets;
	}

	$this->widgets = [];
	$typeList = SiteButton\Manager::getTypeList();
	foreach ($typeList as $typeId => $typeName)
	{
		if(!$this->button->hasActiveItem($typeId))
		{
			continue;
		}

		$item = $this->button->getItemByType($typeId);
		$config = $item['CONFIG'] ?? [];
		$typeWidgets = SiteButton\ChannelManager::getWidgets(
			$typeId,
			$item['EXTERNAL_ID'],
			$this->button->isCopyrightRemoved(),
			$this->languageId,
			$config
		);

		if(count($typeWidgets) <= 0)
		{
			continue;
		}

		$pages = [
			'mode' => 'EXCLUDE',
			'list' => []
		];
		if($this->button->hasItemPages($typeId))
		{
			$pages['mode'] = $item['PAGES']['MODE'];
			$pages['list'] = $item['PAGES']['LIST'][$pages['mode']];
		}

		$workTime = $this->button->getItemWorkTime($typeId);
		if ($workTime['ENABLED'])
		{
			$workTime = SiteButton\WorkTime::convertToJS($workTime);
		}
		else
		{
			$workTime = null;
		}

		foreach ($typeWidgets as $typeWidget)
		{
			$typeWidget['type'] = $typeId;
			$typeWidget['pages'] = $pages;
			$typeWidget['workTime'] = $workTime;
			$this->widgets[] = $typeWidget;
		}
	}

	return $this->widgets;
}