Documentation

AddPanelButton

CMain::AddPanelButton(
 array button,
 array MenuItem
)

The method adds a button to the Control panel. Non-static method.

Parameters

ParameterDescription Available from version
button Array describing the added button. Array keys:
  • HREF - link descriptor on the button
  • SRC - path from the site root to image which will be displayed on the button
  • ALT - button tooltip text
  • MAIN_SORT - sorting index for group of buttons. This parameter has the following values for standard icon groups:
    • 100 - icon group for statics module
    • 200 - icon group for workflow module
    • 300 - icon group for information blocks module
  • SORT - sorting index inside icon group
  • TYPE - (BIG/SMALL) icon size. (By default: "SMALL".)
  • HINT - Array with keys:
    • TITLE - Tooltip title;
    • TEXT - Tooltip text.
  • ICON - icon CSS.
  • TEXT - icon text.
If a user does not have sufficient access permission rights for a required operation but the icon is still must be displayed - leave HREF empty. As the result, the icon will be displayed in black and white colours and without the link.
MenuItemMenu array

See Also

Examples of use

<?
// get access permission to Web forms module
$FORM_RIGHT = $APPLICATION->GetUserRight("form");
// if the access permission is available
if($FORM_RIGHT>"D"):
    // add a button to the control panel leading to the list of web forms 
    $APPLICATION->AddPanelButton(array(
        "HREF"      => "/bitrix/admin/form_list.php", 
        "SRC"       => "/bitrix/images/fileman/panel/web_form.gif", 
        "ALT"       => "Edit Web from", 
        "MAIN_SORT" => 400, 
        "SORT"      => 100
    ));
endif;
?>

Icon submenu (via the example of sticker button):

MENU => Array(
 [0] => Array(
  [TEXT] => <div style="float: left; margin: 0 50px 0 0;">Post the stricker</div>
  [TITLE] => Post the new sticker on the page
  [ICON] =>
  [ACTION] => if (wind ow .oBXSticker){window .oBXSticker.AddSticker();}
  [DEFAULT] => 1
  [HK_ID] => FMST_PANEL_STICKER_ADD
 )
 [1] => Array(
  [SEPARATOR] => 1
 )
)


© «Bitrix24», 2001-2024
Up