- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/documentgenerator/value/address.php
- Класс: Bitrix\Crm\Integration\DocumentGenerator\Value\Address
- Вызов: Address::toString
public function toString($modifier = null): string { if(is_string($this->value)) { return $this->value; } if(!is_array($this->value)) { return ''; } $options = $this->getOptions($modifier); $options['SEPARATOR'] = (int)$options['SEPARATOR']; $options['FORMAT'] = (int)$options['FORMAT']; $options['SHOW_TYPE'] = $options['SHOW_TYPE'] ?? null; $addressFormatter = AddressFormatter::getSingleInstance(); switch ($options['SEPARATOR']) { case AddressSeparator::Comma: $result = $addressFormatter->formatTextComma($this->value, $options['FORMAT']); break; case AddressSeparator::NewLine: $result = $addressFormatter->formatTextMultiline($this->value, $options['FORMAT']); break; case AddressSeparator::HtmlLineBreak: $result = $addressFormatter->formatHtmlMultiline($this->value, $options['FORMAT']); break; default: $result = $addressFormatter->formatTextComma($this->value, $options['FORMAT']); } unset($addressFormatter); if($options['SHOW_TYPE'] === true && !empty($this->value['TYPE'])) { $separator = AddressSeparator::getSeparator($options['SEPARATOR']); $separator = str_replace(',', '', $separator); $result .= $separator . '(' . $this->value['TYPE'] . ')'; } return $result; }