public function CIBlockElement::createMnemonicCode
 array $element,
 array array $options = []

Non-static method for creating a symbolic code. It differs from generating method because it checks for code existence in the database, performs a uniqueness check and adds to the end of numerical index, if generated code exist. It's recommended to use it for the work; disable the option Use external translation engine in iblock settings.

Returned value:

  • null - in case of errors
  • string - string with symbolic code

Function parameters

Parameter Description
$element Array describing iblock element. Type: array, with array keys:
  • NAME - non-empty name string for which you need to generate a symbolic code. Type: string; required/mandatory.
  • IBLOCK_ID - information block identifier. Type: integer (int); mandatory/required
  • ID - element identifier. Type: integer (int) or null, optional. When specifying as not 'null' - adds a condition by entry ID to the filter
$options Re-definable transliteration settings. Type: array, optional in general case. Contains keys, identical to $options for the method [link=13948820]CIBlockElement::generateMnemonicCode[/link] with a single supplement:
CHECK_SIMILAR - check for similar parameter. String type, values: Y/N, optional. Used if symbolic code must be unique. After verifying that generated code already exist, searches by all variants of "symbolicCode_INTEGER": adds an integer to symbolic code for variant that doesn't yet exist in the database.

© «Bitrix24», 2001-2024