• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/helper/widget.php
  • Класс: BitrixReportVisualConstructorHelperWidget
  • Вызов: Widget::constructNewPseudoWidgetByParams
static function constructNewPseudoWidgetByParams($params)
{
	if (!isset($params['viewType']))
	{
		throw new ArgumentException('viewType argument not exist');
	}

	if (!isset($params['widgetId']))
	{
		throw new ArgumentException('widgetId argument not exist');
	}

	if (!isset($params['boardId']))
	{
		throw new ArgumentException('boardId argument not exist');
	}

	if (!isset($params['categoryKey']) || $params['categoryKey'] === 'myWidgets')
	{
		$categoryKey = '';
	}
	else
	{
		$categoryKey = $params['categoryKey'];
	}

	$viewKey = $params['viewType'];
	$boardId = $params['boardId'];
	$viewController = ViewProvider::getViewByViewKey($viewKey);
	$widgetHandler = $viewController->buildWidgetHandlerForBoard($boardId);
	$widgetHandler = $viewController->addDefaultReportHandlersToWidgetHandler($widgetHandler);
	$widget = $widgetHandler->getWidget();
	$widget->setCategoryKey($categoryKey);
	$widget->setConfigurations($widgetHandler->getConfigurations());
	$widget->setGId('pseudo_' . randString(4));

	return $widget;
}