We use the class "ui::" and the parameter "handler_contextmenu", and in the handler - helpers
cxmenu_header(); cxmenu_element(); cxmenu_btn(); cxmenu_delimiter(); ojcxmenu().
$args = array();
$args['theme'] = 'outline-primary';
$args['text'] = 'Test button';
$args['handler_contextmenu'] = 'my_contextmenu';
$str .= ui::btn($args);public function my_contextmenu(){
cxmenu_header('My header text');
cxmenu_element('My string element 1');
cxmenu_btn('My button 1', 'show_hello_msg', true, 'user');
cxmenu_delimiter();
cxmenu_btn('My button 2', 'show_handsome_msg', true, 'user');
cxmenu_element('My string element 2');
ojcxmenu();
}Use the helper «create_cxmenu()» in the tag with content where the context menu is needed.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi commodo elementum justo at tempus. Praesent placerat vestibulum dui id feugiat. Vivamus quis magna a diam faucibus consectetur. Suspendisse neque augue, hendrerit in lectus sit amet, laoreet blandit velit. Sed et iaculis enim. Ut sed sapien aliquet eros pretium lobortis a id magna. Donec tincidunt, magna vel semper interdum, erat neque tempor risus, sed hendrerit magna augue in lectus.
$str .= '<div class="mb-3 text-info" '.create_cxmenu('my_contextmenu').'>';
$str .= 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi commodo elementum justo at tempus. Praesent placerat vestibulum dui id feugiat. Vivamus quis magna a diam faucibus consectetur. Suspendisse neque augue, hendrerit in lectus sit amet, laoreet blandit velit. Sed et iaculis enim. Ut sed sapien aliquet eros pretium lobortis a id magna. Donec tincidunt, magna vel semper interdum, erat neque tempor risus, sed hendrerit magna augue in lectus.';
$str .= '</div>';public function my_contextmenu(){
cxmenu_header('My header text');
cxmenu_element('My string element 1');
cxmenu_btn('My button 1', 'show_hello_msg', true, 'user');
cxmenu_delimiter();
cxmenu_btn('My button 2', 'show_handsome_msg', true, 'user');
cxmenu_element('My string element 2');
ojcxmenu();
}