Button::buildFromArray

  1. Bitrix24 API (v. 23.675.0)
  2. ui
  3. Button
  4. buildFromArray
  • Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/buttons/split/button.php
  • Класс: Bitrix\UI\Buttons\Split\Button
  • Вызов: Button::buildFromArray
protected function buildFromArray($params)
{
	$mainOptions = $menuOptions = [];

	if (!empty($params['mainButton']))
	{
		$mainOptions = $params['mainButton'];
	}
	if (!empty($params['menuButton']))
	{
		$menuOptions = $params['menuButton'];
	}
	unset($params['tag']);

	$mainOptions['buttonType'] = Type::MAIN;
	$menuOptions['buttonType'] = Type::MENU;

	$this->mainButton = new SubButton($mainOptions);
	$this->menuButton = new SubButton($menuOptions);
	$this->mainButton->setSplitButton($this);
	$this->menuButton->setSplitButton($this);

	if (isset($params['menuTarget']) && $params['menuTarget'] === Type::MENU)
	{
		$this->menuTarget = Type::MENU;
	}

	parent::buildFromArray($params);
}

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