• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/userconsent/agreement.php
  • Класс: BitrixMainUserConsentAgreement
  • Вызов: Agreement::getLabel
public function getLabel()
{
	$text = $this->isCustomType() ? $this->data['LABEL_TEXT'] : $this->intl->getLabelText();
	$text = Text::replace($text, $this->replace);

	if ($this->data['USE_URL'] !== 'Y' || !$this->data['URL'])
	{
		return str_replace('%', '', $text);
	}

	$text = trim(trim($text), "%");
	$text = explode('%', $text);
	$text = array_filter($text);

	/** @var array $text */
	switch (count($text))
	{
		case 0:
		case 1:
		$text = array_merge([''], $text, ['']);
			break;

		case 2:
			$text[] = '';
			break;

		case 3:
			break;

		default:
			$text = array_merge(
				array_slice($text, 0, 2),
				[implode('', array_slice($text, 2))]
			);
			break;
	}

	return implode('%', $text);
}