WidgetConfig::__construct

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. WidgetConfig
  4. __construct
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/widget/widgetconfig.php
  • Класс: Bitrix\Crm\Widget\WidgetConfig
  • Вызов: WidgetConfig::__construct
public function __construct(array $settings)
{
	if(isset($settings['name']) && is_string($settings['name']) && $settings['name'] !== '')
	{
		$this->setName($settings['name']);
	}

	if(isset($settings['title']) && is_string($settings['title']) && $settings['title'] !== '')
	{
		$this->setTitle($settings['title']);
	}

	if(isset($settings['dataSource']) && is_string($settings['dataSource']) && $settings['dataSource'] !== '')
	{
		$dataSourceSettings = array('name' => $settings['dataSource']);
		if(isset($settings['dataPreset']) && is_string($settings['dataPreset']) && $settings['dataPreset'] !== '')
		{
			$dataSourceSettings['presetName'] = $settings['dataPreset'];
		}
		$this->setDataSourceSettings($dataSourceSettings);
	}
	else
	{
		$this->setDataSourceSettings(
			isset($settings['dataSource']) && is_array($settings['dataSource']) ? $settings['dataSource'] : array()
		);
	}

	if(isset($settings['select']) && is_array($settings['select']))
	{
		$select = $settings['select'];
		if(isset($select['name']) && is_string($select['name']))
		{
			$this->setSelectField($select['name']);
		}

		if(isset($select['aggregate']) && is_string($select['aggregate']))
		{
			$this->setAggregate($select['aggregate']);
		}
	}

	if(isset($settings['group']) && is_string($settings['group']) && $settings['group'] !== '')
	{
		$this->setGroupField($settings['group']);
	}

	if(isset($settings['filter']) && is_array($settings['filter']))
	{
		$this->setFilterParams($settings['filter']);
	}

	if(isset($settings['sort']) && is_array($settings['sort']))
	{
		$this->setSortParams($settings['sort']);
	}

	if(isset($settings['display']) && is_array($settings['display']))
	{
		$this->setDispalyParams($settings['display']);
	}

	if(isset($settings['format']) && is_array($settings['format']))
	{
		$this->setFormatParams($settings['format']);
	}

	if(isset($settings['extras']) && is_array($settings['extras']))
	{
		$this->setExtraParams($settings['extras']);
	}
}

Добавить комментарий