• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/controller/widget.php
  • Класс: BitrixReportVisualConstructorControllerWidget
  • Вызов: Widget::addReportToWidget
private function addReportToWidget(BitrixReportVisualConstructorEntityWidget $widget, $configuration)
{
	if (!empty($configuration['new']['reportHandler']))
	{
		$reportHandler = Report::buildReportHandlerForWidget($configuration['new']['reportHandler'], $widget);
		if ($reportHandler instanceof BaseReport)
		{
			foreach ($configuration['new'] as $key => $configurationValue)
			{
				$formElement = $reportHandler->getFormElementFromCollected($key);
				if ($formElement instanceof BaseValuable)
				{
					$formElement->setValue($configurationValue);
					$reportConfiguration = $reportHandler->getConfiguration($key);
					if ($reportConfiguration)
					{
						$reportConfiguration->setValue($formElement->getValue());
					}
				}
			}
			$reportHandler->getReport()->setConfigurations($reportHandler->getConfigurations());
			$widget->addReportHandler($reportHandler);
			$widget->save();
		}


	}
}