Documentation

AddActions

void
CAdminListRow::AddActions(
  array $arActions
)

The AddActions method configures a context menu for table row. The menu parameters are specified as an array whose elements are associated arrays with the following keys.

Key Description
ICON The name of the CSS class for the action icon.
DISABLED Specifies that the menu item is disabled (true|false).
DEFAULT Specifies that the menu item performs a default action (true|false) when activated.
TEXT The menu item name.
TITLE The menu item tooltip text.
ACTION The action to be performed upon the menu item activation (Javascript).
SEPARATOR Inserts a separator {true|false}. If true, other keys are ignored.

Example:

// build a context menu
$arActions = Array(); // element editing $arActions[] = array( "ICON"=>"edit", "DEFAULT"=>true, "TEXT"=>GetMessage("rub_edit"), "ACTION"=>$lAdmin->ActionRedirect("rubric_edit.php?ID=".$f_ID) ); // element deletion if ($POST_RIGHT>="W") $arActions[] = array( "ICON"=>"delete", "TEXT"=>GetMessage("rub_del"), "ACTION"=>"if(confirm('".GetMessage('rub_del_conf')."')) ".
            $lAdmin->ActionDoGroup($f_ID, "delete") ); // insert a separator $arActions[] = array("SEPARATOR"=>true); // check the template for automatically generated mail lists if (strlen($f_TEMPLATE)>0 && $f_AUTO=="Y") $arActions[] = array( "ICON"=>"", "TEXT"=>GetMessage("rub_check"), "ACTION"=>$lAdmin->ActionRedirect("template_test.php?ID=".$f_ID) ); // if separator comes last, remove it. if(is_set($arActions[count($arActions)-1], "SEPARATOR")) unset($arActions[count($arActions)-1]); // attach context menu to the row $row->AddActions($arActions);
© «Bitrix24», 2001-2024