@@ 178-196 (lines=19) @@ | ||
175 | * @param $element |
|
176 | * @param string $label |
|
177 | */ |
|
178 | public static function editHLBlockElement($template, $element, $label = 'Изменить элемент') |
|
179 | { |
|
180 | if (!$GLOBALS['APPLICATION']->GetShowIncludeAreas()) { |
|
181 | return; |
|
182 | } |
|
183 | ||
184 | if (!$element["HLBLOCK_ID"] && $element["HLBLOCK_TABLE_NAME"]) { |
|
185 | $element["HLBLOCK_ID"] = static::prepareHLBlockIdByTableName($element["HLBLOCK_TABLE_NAME"]); |
|
186 | } |
|
187 | ||
188 | if (!$element["HLBLOCK_ID"] || !$element['ID']) { |
|
189 | throw new InvalidArgumentException('Element must include ID and HLBLOCK_ID/HLBLOCK_TABLE_NAME'); |
|
190 | } |
|
191 | ||
192 | $linkTemplate = '/bitrix/admin/highloadblock_row_edit.php?ENTITY_ID=%s&ID=%s&lang=ru&bxpublic=Y'; |
|
193 | $link = sprintf($linkTemplate, (int) $element["HLBLOCK_ID"], (int) $element["ID"]); |
|
194 | ||
195 | $template->AddEditAction('hlblock_element_' . $element['ID'], $link, $label); |
|
196 | } |
|
197 | ||
198 | /** |
|
199 | * @param CBitrixComponentTemplate $template |
|
@@ 204-222 (lines=19) @@ | ||
201 | * @param string $label |
|
202 | * @param string $confirm |
|
203 | */ |
|
204 | public static function deleteHLBlockElement($template, $element, $label = 'Удалить элемент', $confirm = 'Вы уверены, что хотите удалить элемент?') |
|
205 | { |
|
206 | if (!$GLOBALS['APPLICATION']->GetShowIncludeAreas()) { |
|
207 | return; |
|
208 | } |
|
209 | ||
210 | if (!$element["HLBLOCK_ID"] && $element["HLBLOCK_TABLE_NAME"]) { |
|
211 | $element["HLBLOCK_ID"] = static::prepareHLBlockIdByTableName($element["HLBLOCK_TABLE_NAME"]); |
|
212 | } |
|
213 | ||
214 | if (!$element["HLBLOCK_ID"] || !$element['ID']) { |
|
215 | throw new InvalidArgumentException('Element must include ID and HLBLOCK_ID/HLBLOCK_TABLE_NAME'); |
|
216 | } |
|
217 | ||
218 | $linkTemplate = '/bitrix/admin/highloadblock_row_edit.php?action=delete&ENTITY_ID=%s&ID=%s&lang=ru'; |
|
219 | $link = sprintf($linkTemplate, (int) $element["HLBLOCK_ID"], (int) $element["ID"]); |
|
220 | ||
221 | $template->AddDeleteAction('hlblock_element_' . $element['ID'], $link, $label, array("CONFIRM" => $confirm)); |
|
222 | } |
|
223 | ||
224 | /** |
|
225 | * @param CBitrixComponentTemplate $template |