Bitrix Site Manager

Creating custom tabs in the forms

This topic describes how you can create custom tabs in Control Panel.

To create custom tabs, you will have to:

  1. implement tab handlers as a class or functions;
  2. Register the tab event by calling AddeventHandler or RegisterModuleDependencies.

The class must implement the following methods:

Example of a class implementing custom tabs

class CCustomOETabs
    function OnInit()
        return array(
        "TABSET" => "YYY",
        "GetTabs" => array("CCustomOETabs", "GetTabs"),
        "ShowTab" => array("CCustomOETabs", "ShowTab"),
        "Action" => array("CCustomOETabs", "Action"),
        "Check" => array("CCustomOETabs", "Check"),

    function Action($arArgs)
        // Data is stored. Perfom actions here.
        // Return true on success, or false otherwise.
        // In case of error, also call $GLOBALS["APPLICATION"]-> ThrowException("ERROR!!!");

    function Check($arArgs)
        // Data has not been stored yet. Perform various checks here.
        // Return true if data can be saved, or false otherwise.
        // If false, also call $GLOBALS["APPLICATION"]-> ThrowException("ERROR!!!");

    function GetTabs($arArgs)
        // SORT - specifies the insertion position (in terms of standard tabs).
      // If not specified, inserts after the last tab. $arTabs = array( array("DIV" => "edit1", "TAB" => "Custom tab 1", "ICON" => "sale", "TITLE" => "Custom tab 1", "SORT" => 1), ); return $arTabs; } function ShowTab($divName, $arArgs, $bVarsFromForm) { if ($divName == "edit1") { ?> <tr> <td width="40%">Custom field 1:</td> <td width="60%"><input type="text" name="custom_field_1"></td> </tr> <? } } }

All methods (except ShowTab) receive an array of arguments specified using in the CAdminTabEngine class constructor or the CAdminTabEngine::SetArgs method. The format of an array returned by GetTabs is described here.