• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/admin/helper.php
  • Класс: BitrixSaleLocationAdminHelper
  • Вызов: Helper::readMap
static function readMap($entityRoadCode, $page = 'list')
{
	$roads = static::getEntityRoadMap();
	$road = $roads[$entityRoadCode];

	if(!$road['name'])
		throw new MainSystemException('Undefined entity name in entity map');

	if($page == '')
		$page = 'list';

	$flds = array();
	$class = $road['name'].'Table';
	$excluded = $road['pages'][$page]['excludedColumns'] ?? null;
	$included = $road['pages'][$page]['includedColumns'] ?? null;

	$map = $class::getMap();
	if (!empty($road['additional']) && is_array($road['additional']))
	{
		$map = array_merge($map, $road['additional']);
	}

	foreach ($map as $fldCode => $fldDesc)
	{
		if (is_array($excluded) && in_array($fldCode, $excluded))
		{
			continue;
		}

		if (is_array($included) && !in_array($fldCode, $included))
		{
			continue;
		}

		if (
			is_array($fldDesc)
			&& (
				(isset($fldDesc['title']) && mb_strlen($fldDesc['title']))
				|| (isset($fldDesc['required']) && $fldDesc['required'])
				|| (isset($fldDesc['primary']) && $fldDesc['primary'])
				|| $fldCode === 'ID'
			)
		)
		{
			$title = trim((string)($fldDesc['title'] ?? ''));
			$fldDesc['title'] = $title !== ''? htmlspecialcharsbx($title) : $fldCode;
			$fldDesc['ownerEntity'] = $road['name']; // map can be cumulative, from several entites, so we need to know who is an owner
			$flds[$fldCode] = $fldDesc;
		}
	}

	return $flds;
}