- Модуль: location
- Путь к файлу: ~/bitrix/modules/location/lib/entity/address/converter/stringtemplateconverter.php
- Класс: BitrixLocationEntityAddressConverterStringTemplateConverter
- Вызов: StringTemplateConverter::parseFieldText
private function parseFieldText(array $context): array
{
$textBlockStartPosition = $context['position'];
$matches = null;
// [", ", [ADDRESS_LINE_1:N,ADDRESS_LINE_2,"Text",LOCALITY,ADM_LEVEL_2]]
// Are looking for ^^^^^^
if (preg_match(
'/' . self::REGEX_GROUP_FIELD_TEXT . '/ms' . BX_UTF_PCRE_MODIFIER,
$context['template'],
$matches,
PREG_OFFSET_CAPTURE,
$context['position']
)
&& $matches[0][1] === $textBlockStartPosition
)
{
$context['info'] = [
'type' => 'text',
'position' => $textBlockStartPosition,
'end' => $textBlockStartPosition + strlen($matches[0][0]),
'value' => $this->unescapeText(
substr(
$context['template'],
$textBlockStartPosition + 1,
strlen($matches[1][0]) - 2
)
),
];
$context['position'] = $context['info']['end'];
}
else
{
$this->addContextError($context, self::ERR_PARSE_GROUP_FIELD_TEXT, $textBlockStartPosition);
}
return $context;
}