Developer Center

EN

Multi-Purpose Cleint Area Buttons

To define multi-purpose buttons in client area output, first make sure that clientArea() function is defined and clientArea_buttons_output() function is called in it.

For defining the buttons, you should create clientArea_buttons() function and the return of the function should be an array, the sample function is specified below.

Button Array Parameters

  • text : Button name that will be displayed on the screen
  • type : Specifies the type of button, the values it will have are:

    transaction : When the button is clicked, assigns a request to the special function which you defined for the client area with javascript ajax. The value to return must be of JSON data type and the parameters (status (example: successful or error), message) must be returned. You must define the name of the function-specific to the key value of the button.

    page-loader : When the button is clicked, javascript returns the output of the custom page that you have defined for the client area with ajax, you must define the name of the custom page to the key value of the button.

    page : When the button is clicked, it refreshes the page and outputs the custom page you have defined for the client area, you must define the file name (without extension) of the custom page to the key value of the button.

    function : When the button is clicked, it refreshes the page and displays the output of the special function you defined, you need to define the name of the special function to the key value of the button.

    link : When the button is clicked, it refreshes the page and redirects it to the URL address you have defined.
  • url : If it is a link type button, you must define the URL address to redirect.
  • icon : You can use Fontawesome Icons, Ionicons icon libraries, eg: fa fa-rocket
  • target_blank : Boolean data type must be defined as "true" for the buttons that refresh the page to open in a new tab when clicked.
public function clientArea_buttons()
{
$buttons = [];

if($this->page && $this->page != "home")
{
$buttons['home'] = [
'text' => $this->lang["turn-back"],
'type' => 'page-loader',
];
}
else
{

$buttons['custom_transaction'] = [
'text' => 'Run Transaction',
'type' => 'transaction',
];

$buttons['another'] = [
'text' => 'Another Page',
'type' => 'page-loader',
];

$buttons['custom_function'] = [
'text' => 'Open Function',
'type' => 'function',
'target_blank' => true,
];

$buttons['another-link'] = [
'text' => 'Another link',
'type' => 'link',
'url' => 'https://www.google.com',
'target_blank' => true,
];
}

return $buttons;
}
Defining Custom Pages and Functions for Client Area Adding Field to Admin Area Service Detail

Do you have any questions?

We have a great team to answer your queries
Contact Us
Copyright © 2020. All rights reserved.
Join Our Discord Channel
Top