Files
progcode/docs/rebuild-v2/evidence/code/bitrix-api-функция-для-ге-0.php
T

12 lines
376 B
PHP

function strToElementCode($str, $maxLength = 100) {
if ($maxLength < 1) {
throw new InvalidArgumentException('maxLength must be positive');
}
return CUtil::translit($str, 'ru', [
'max_len' => $maxLength,
'change_case' => 'L',
'replace_space' => '_',
'replace_other' => '_',
'delete_repeat_replace' => true,
]);
}