• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/controller/widget.php
  • Класс: BitrixReportVisualConstructorControllerWidget
  • Вызов: Widget::updateAction
public function updateAction($boardKey, $widgetId, $params)
{
	$dashboardForUser = DashboardHelper::getDashboardByKeyForCurrentUser($boardKey);

	if (!$dashboardForUser)
	{
		$this->addError(new Error('Can't update widget because current user has not dashboard to edit'));
		return false;
	}

	$widget = BitrixReportVisualConstructorEntityWidget::getCurrentUserWidgetByGId($widgetId);
	if ($widget)
	{

		if (!empty($params['rowId']) && $params['rowId'] != $widget->getRow()->getGId())
		{
			$row = DashboardRow::getCurrentUserRowByGId($params['rowId']);

			if ($row)
			{
				$widget->setRow($row);
			}
			else
			{
				$this->addError(new Error("No row with id: " . $params['rowId']));
			}
		}

		$widget->getRow()->setLayoutMap($params['rowLayoutMap']);


		if (!empty($params['cellId']))
		{
			$widget->setWeight($params['cellId']);
		}

		$widget->save();
		return $widget->getGId();
	}
	else
	{
		$this->addError(new Error("No widget with id: " . $widgetId));
		return null;
	}

}