Views: 11938
Last Modified: 12.09.2014
When creating own projects, it may become necessary to create new buttons on the Control Panel. Buttons can be added to the Control Panel as follows:
<?$APPLICATION->AddPanelButton(
Array(
"ID" => "Button ID", //Defines the uniqueness of the button
"TEXT" => "Name of the button",
"TYPE" => "BIG", //BIG – a big button, otherwise it will be a small button
"MAIN_SORT" => 100, //sorting index for a group of buttons
"SORT" => 10, //sorting inside the group
"HREF" => "Goto URL", //or javascript:MyJSFunction())
"ICON" => "icon-class", //name of CSS class with a button icon
"SRC" => "button icon path",
"ALT" => "Prompt text", //old variant
"HINT" => array( //tool type of the button
"TITLE" => "Tool type header",
"TEXT" => "Tool type tex" //HTML is allowed
),
"HINT_MENU" => array( //Tool type for a context menu button
"TITLE" => "Tool type header",
"TEXT" => "Tool type text" //HTML is allowed
),
"MENU" => Array(
Array( //array of context menu options
"TEXT" => "Name of the option",
"TITLE" => "Option prompt",
"SORT" => 10, //Option sorting index
"ICON" => "", //Option icon
"ACTION" => "Javascript code",
"SEPARATOR" => true, //determines a separating point
"DEFAULT" => true, //default option?
"MENU" => Array() //submenu array
)
)
),
$bReplace = false //replace the existing button with new data?
);
?>
There are several options to add a button from:
- In a component
- On a page
- In a website template
- In the even OnBeforeProlog