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.
How to create buttons or tabs inside all pages using  action buttons $actionButton
How to create buttons or tabs inside all pages using action buttons $actionButton

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 the value of each button is the url, Button text and icon (font -awesome) all separated with colons ":"

 

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

 

For Edit pages or pages not in the menu:

 

$optionType = 'VFEDLPSIUW';

$elmid = 'edit_article';

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

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

 

or (Not recommended)

 

$elmid = 'add_article';
$actionButton[1] = '/kas/op_PAGE~NAME-'.$KMID.'-'.$KSMID.'-'.$KSMOID.'_'.$idvalue.'_VDNWL.kas':ADD NEW ARTICLE:<i class="fas fa-layer-plus"></i>:'.$elmid;

 

The last paramater ":$elmid" is optional and it let's use choose a specifc id="value" for the button in case you need to interact with JavaScript, id you do not add al element id, 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

You can also add ?var=value but it is optional, it is if you need to send a query string.

 

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

 

 

 

 

 

Commentaires