Skip to content

Instantly share code, notes, and snippets.

@EscApp2
Last active May 1, 2024 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EscApp2/d6fea8bc8a00f7df11569d9bbe38276b to your computer and use it in GitHub Desktop.
Save EscApp2/d6fea8bc8a00f7df11569d9bbe38276b to your computer and use it in GitHub Desktop.
Добавить кнопку таб страницу текст в админке admin add button add page tab tabs
В init.php, а лучше в подключаемом в нем файле:
подписываемся на событие OnAdminTabControlBegin (событие OnAdminTabControlBegin вызывается в функции CAdminTabControl::Begin() при выводе в административном интерфейсе формы редактирования).
подписываемся на событие OnAdminListDisplay (Событие OnAdminListDisplay вызывается в функции CAdminList::Display() при выводе в административном разделе списка элементов).
use \Bitrix\Main\EventManager;
$eventManager = EventManager::getInstance();
$eventManager->addEventHandler('main', 'OnAdminTabControlBegin', ['\LocalNamespase\Handlers', 'onAdminTabControlBegin']);
$eventManager->addEventHandler('main', 'OnAdminListDisplay', ['\LocalNamespase\Handlers', 'onAdminListDisplay']);
<?php
public static function onAdminTabControlBegin(&$form)
{
static $init;
if (!$_REQUEST['ID']) {
return;
}
switch ($form->name) {
case 'order_edit_info':
// защита от повторной инициализации
if ($init[$form->name]) {
return;
}
// внедряем нужный скрипт
Asset::getInstance()->addJs('/local/templates/index/js/some_script.js');
break;
}
}
public static function onAdminListDisplay(&$list)
{
global $APPLICATION;
switch ($list->table_id) {
case 'tbl_sale_buyers_profile_tab1':
// внедряем нужный скрипт
Asset::getInstance()->addJs('/local/templates/index/js/some_script.js');
break;
}
}
$customTabber = new CAdminTabEngine("OnAdminSaleOrderCreate");
$customTabber = new CAdminTabEngine("OnAdminSaleOrderView", array("ID" => $id));
$customTabber = new CAdminTabEngine("OnAdminIBlockElementEdit", array("ID" => $ID, "IBLOCK"=>$arIBlock, "IBLOCK_TYPE"=>$arIBTYPE));
$customTabber = new CAdminTabEngine("OnAdminIBlockSectionEdit", array("ID" => $ID, "IBLOCK"=>$arIBlock, "IBLOCK_TYPE"=>$arIBTYPE));
$customTabber = new CAdminTabEngine("OnAdminSaleOrderView", array("ID" => $ID));
$customTabber = new CAdminTabEngine("OnAdminSaleOrderEdit", array("ID" => $ID));
https://gdecider.github.io/articles-bx-admin-customisation.html
https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&CHAPTER_ID=03433&LESSON_PATH=3913.3435.3433
https://dev.1c-bitrix.ru/api_help/main/events/onadmintabcontrolbegin.php
https://dev.1c-bitrix.ru/community/webdev/user/11948/blog/2525/?commentId=21676
https://www.acrit-studio.ru/pantry-programmer/knowledge-base/adminka-primer-dobavleniya-svoikh-elementov/
https://www.acrit-studio.ru/pantry-programmer/knowledge-base/interfeys-ermitazh/adminka-primer-dobavleniya-svoikh-elementov/
https://dev.1c-bitrix.ru/support/forum/forum6/topic85859/
https://pai-bx.com/wiki/1c-bitrix/2318-custom-button-bitrx-adminpage/
https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=7957
https://zhurov.me/blog/bitrix-custom-tabs.html
https://dev.1c-bitrix.ru/api_help/main/general/admin.section/tabengine.php
https://forwww.com/bitrix-add-user-button/
https://github.com/DigitalWand/digitalwand.admin_helper/tree/2.x
https://bitrix.pushorigin.ru/orm/entity-datamanager/generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment