• Модуль: market
  • Путь к файлу: ~/bitrix/modules/market/lib/Application/Rights.php
  • Класс: BitrixMarketApplicationRights
  • Вызов: Rights::__construct
public function __construct(array $rights)
{
	Loc::loadMessages($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/rest/scope.php');

	foreach ($rights as $key => $scope) {
		$scopeName = str_replace('/', '', mb_strtolower($key));

		$this->rights[] = [
			'CODE' => $key,
			'TITLE' => Loc::getMessage('REST_SCOPE_' . mb_strtoupper($key)) ?: $scope,
			'DESCRIPTION' => (string)Loc::getMessage('REST_SCOPE_' . mb_strtoupper($key) . '_DESCRIPTION'),
			'ICON' => '/bitrix/images/market/scope/market-icon-' . $scopeName . '.svg',
		];
	}

	usort($this->rights, [$this, 'sort']);

	$currentLength = 0;
	$maxLength = 130;
	foreach ($this->rights as $right) {
		$currentLength += mb_strlen($right['TITLE']);

		if ($currentLength > $maxLength) {
			$this->showMoreButton = true;
		} else {
			$this->quantityToShow++;
		}
	}
}