• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/controller/widget.php
  • Класс: BitrixReportVisualConstructorControllerWidget
  • Вызов: Widget::buildFormAction
public function buildFormAction($params)
{
	$componentName = 'bitrix:report.visualconstructor.widget.form';

	$boardId = $params['boardId'];
	$mode = $params['mode'];
	try
	{
		$widget = BitrixReportVisualConstructorHelperWidget::constructNewPseudoWidgetByParams($params);
	}
	catch (ArgumentException $e)
	{
		$this->addError(new Error($e->getMessage()));
		return false;
	}

	$widget->setGId('pseudo_widget_for_add');
	if ($widget)
	{
		$templateName = '';
		$params = array(
			'MODE' => $mode,
			'ORIGINAL_WIDGET_GID' => $params['widgetId'],
			'WIDGET' => $widget,
			'BOARD_ID' => $boardId,
			'PAGE_TITLE' => $mode === 'create' ? Loc::getMessage('REPORT_CREATE_WIDGET_SETTINGS_CONTENT_TITLE') : Loc::getMessage('REPORT_WIDGET_SETTINGS_CONTENT_TITLE'),
			'SAVE_BUTTON_TITLE' => $mode === 'create' ? Loc::getMessage('REPORT_CREATE_WIDGET_SETTINGS_SAVE_BUTTON_TITLE') : Loc::getMessage('REPORT_WIDGET_SETTINGS_SAVE_BUTTON_TITLE'),
		);
		return new Component($componentName, $templateName, $params);
	}
	else
	{
		$this->addError(new Error('No widget with this id'));
		return false;
	}
}