21 public static function getId(): string
23 return 'code_translit';
28 return Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_NAME_MSGVER_1');
33 if (empty($rawFields[
'ID']))
38 $rowId = (int)$rawFields[
'ID'];
44 empty($this->getSectionTranslitSettings())
54 empty($this->getElementTranslitSettings())
68 $data = CUtil::PhpToJSObject([
74 $confirmMessageTitle = \CUtil::JSEscape(
Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_SECTION_CONFIRM_TITLE'));
75 $confirmMessageContent = \CUtil::JSEscape(
Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_SECTION_CONFIRM_CONTENT'));
79 $confirmMessageTitle = \CUtil::JSEscape(
Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_ELEMENT_CONFIRM_TITLE'));
80 $confirmMessageContent = \CUtil::JSEscape(
Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_ELEMENT_CONFIRM_CONTENT'));
83 $confirmButtonMessage = \CUtil::JSEscape(
86 $backButtonMessage = \CUtil::JSEscape(
90 $this->onclick =
"IblockGridInstance.sendMediumPopupWithConfirm("
93 .
"'{$confirmMessageTitle}', "
94 .
"'{$confirmMessageContent}', "
95 .
"'{$confirmButtonMessage}', "
96 .
"'{$backButtonMessage}')";
98 return parent::getControl($rawFields);
105 $rowIndex = (string)$request->get(
'id');
106 if (empty($rowIndex))
116 [$type, $id] = $index;
121 $this->processCodeTranslitSection($id)->
getErrors()
127 $this->processCodeTranslitElement($id)->
getErrors()
139 private function processCodeTranslitElement(
int $id):
Result
145 $message =
Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_ERROR_ACCESS_DENIED_ELEMENT', [
170 $entity =
new CIBlockElement();
171 $translitSettings = $this->getElementTranslitSettings();
174 'CODE' => CUtil::translit(
180 $updateResult = $entity->Update($id, $fields);
181 if (!$updateResult && $entity->getLastError())
184 new Error($entity->getLastError())
196 private function processCodeTranslitSection(
int $id):
Result
202 $message =
Loc::getMessage(
'IBLOCK_GRID_ROW_ACTIONS_CREATE_CODE_ERROR_ACCESS_DENIED_SECTION', [
227 $entity =
new CIBlockSection();
228 $translitSettings = $this->getSectionTranslitSettings();
231 'CODE' => CUtil::translit(
237 $updateResult = $entity->Update($id, $fields);
238 if (!$updateResult && $entity->getLastError())
241 new Error($entity->getLastError())
static getMessage($code, $replace=null, $language=null)
static getRow(array $parameters)