• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/grid/panel/productgroupaction.php
  • Класс: BitrixCatalogGridPanelProductGroupAction
  • Вызов: ProductGroupAction::actionProductFieldPanel
protected function actionProductFieldPanel(array $params = []): ?array
{
	if (!$this->isAllowedProductActions())
		return null;

	$result = [];
	$items = [];

	if ($this->catalogConfig['CATALOG_TYPE'] !== CCatalogSku::TYPE_PRODUCT)
	{
		foreach ($this->productFieldHandlers as $handler)
		{
			$handler = 'getProductField' . $handler . 'Row';
			if (is_callable([$this, $handler]))
			{
				$row = call_user_func_array([$this, $handler], []);
				if (!empty($row))
				{
					$items[] = $row;
				}
			}
		}
		unset($row, $handler);


	}

	$userFields = CatalogProductSystemField::getGroupActions($this);
	if (!empty($userFields) && is_array($userFields))
	{
		$items = array_merge($items, $userFields);
	}
	unset($userFields);

	if (!empty($items))
	{
		$name = (isset($params['NAME']) && $params['NAME'] != ''
			? $params['NAME']
			: Loc::getMessage('IBLOCK_GRID_PANEL_ACTION_SET_PRODUCT_FIELD')
		);

		$data = [];
		$data[] = [
			'TYPE' => MainGridPanelTypes::DROPDOWN,
			'ID' => $this->getFormProductFieldId(),
			'NAME' => $this->getFormProductFieldName(),
			'ITEMS' => $items
		];
		if ($this->isUiGrid())
		{
			$data[] = $this->getApplyButtonWithConfirm([
				'APPLY_BUTTON_ID' => 'send_product',
				'CONFIRM_MESSAGE' => Loc::getMessage('IBLOCK_GRID_PANEL_ACTION_SET_PRODUCT_FIELD_CONFIRM'),
			]);
		}

		$result = [
			'name' => $name,
			'type' => 'multicontrol',
			'action' => [
				[
					'ACTION' => MainGridPanelActions::RESET_CONTROLS
				],
				[
					'ACTION' => MainGridPanelActions::CREATE,
					'DATA' => $data
				]
			]
		];

		unset($data);
	}
	unset($items);

	return $result;
}