How to create buttons or tabs inside all pages using action buttons $actionButton

To optimize the productivity and efficiency of KAS it is always good to add links towards useful sections without having to navigate to get to them. This is where action buttons become very useful.

Action buttosn are very elegant and are displayed next to the section title like tabs. These links can have a icon at the end using font awesome.

 

To create these action buttons, simply create an array with the following name: $actionButton, although there are 3 other default variables than can be used.

By default there are 3 predefined action buttons that can be added to Articles, separated with collons, add the name of the page and the option type: 

 

$imageGallery = 'ARTICLE IMAGES:VIMPLD';
$videoGallery = 'ARTICLE VIDEOS:FZVTPLD';

 

Ther is also the preview URL that opens the webpage in a separate tag. separated with colons add the file name,langauge,ID column and title column. the last 2 are optional.

 

$previewURL = 'article:en:BLOGID:title_en'; 

or

$previewURL = 'services:en'; 

 

If we need to add more or other action buttons, we use then the  $actionButton array variable, where you can add the following array (Recommended):

 

$actionButton[0] = array(
 link => getPath('BLOGS','BLOG','ADD ARTICLE'),
 text => 'ADD NEW ARTICLE',
 icon => '<i class="fas fa-layer-plus"></i>'  //optional
)

 

or use the inline quick format where the value of each button is the url, Button text and icon (font -awesome) all separated with colons ":" (this format doesn't have target option).

 

$elmid = 'add_article';
$actionButton[0] = getPath('BLOGS','BLOG','ADD ARTICLE').':ADD NEW ARTICLE:<i class="fas fa-layer-plus"></i>:$elmid';

 

Other options can be added scuh as elm ID (an id for each  action button) and target (full HTML attribute and value)

 id => 'edit_article',  // optional
 target => 'target="_blank"' //optional

 

If an ID is not provided, it will automatically assign and id as AB_$i where $i is the element nth value:

id="ab_0"
id="ab_1"
​//and so on

 

For Edit pages or pages not in the menu you need to create the proper link with optionTypes ajnd next ID (array format, recommended):

 

$optionType = 'VFEDLPSIUW';
$nextid = $db_actions->result(0,'AID');

$actionButton[1] = array(
 link => getPath('BLOGS','BLOG','EDIT ARTICLE',$optionType,$nextid),
 text => 'BACK TO EDIT ARTICLE',
 icon => '<i class="fas fa-layer-plus"></i>',  //optional
 id => 'edit_article',  // optional
 target => 'target="_blank"' //optional
)

 

Inline (quick format)

$actionButton[1] = getPath('BLOGS','BLOG','EDIT ARTICLE',$optionType,$nextid).":BACK TO EDIT ARTICLE:<i class="fas fa-layer-plus"></i>:".$elmid;

 

FYI, more parameters can be added to the link as a query string ?var=value

 

link => getPath('BLOGS','BLOG','ADD ARTICLE').'?'.$qstring.';

 

 

 

 

 

Get a Quote

Get a Quote