Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: ArturoRobles

User avatar
By jemiris

Can you tell me is there any possible way to capture the where the plugin is enabled or not :?:

My problem:
i would like the add the custom button in the form when the plugin enbled only not always :?:
Create a hidden field in your Dynaform associated with the variable "pluginLoaded".
Then create the following trigger:
Code: Select all
// change myNamePlugin to the name of your plugin's class:
if (class_exists("myNamePlugin")) {
   @@pluginLoaded = 'yes';
Set this trigger to fire before the Dynaform.

Then add the following JavaScript to your Dynaform:
Code: Select all
if ( $("#pluginLoaded").getValue() == 'yes') {
else {
Thanks for information if it's in the js script page in my plugin how to do that :?:
I have done in php page as you said i could not do for js page. How to check the class exists and enable the button :?:
If your plugin defines a REST endpoint, then you can use $.ajax() or XMLHttpRequest.send() to try to call that REST endpoint and check if the REST endpoint exists. If not, then the class wasn't loaded.

Which .js file? The ProcessMaker PHP framework has ways to set a variable in a .js file when loading a page.
User avatar
By jemiris
Not i dont use REST API :idea: . But i have file called jemirisApplication.js in the plugin directectory. So can i capture where the plugin is enbled in the js file. Any example that shows that whether the plugin is enabled or not :?:
If you are talking about your own custom JavaScript files that you created, then you have to figure out how to set the variables yourself. For example, you can use PHP to check if the class exists and then add statements like this when writing the HTML of the page:
Code: Select all
if (class_exists("myNamePlugin")) {
   print "<script> var classXLoaded = 'yes';</script>";
else {
   print "<script> var classXLoaded = 'no';</script>";
Or you could create a hidden field in the HTML page:
Code: Select all
if (class_exists("myNamePlugin"))
   $val = 'yes';
   $val = 'no';

print "<input id=\"classXLoaded\" name=\"classXLoaded\" type=\"hidden\" value=\"$val\">";
I don't know why you are having to check this. If your JavaScript file is in a plugin, then the plugin's class file was loaded if you are executing its JavaScript file.

Your plugin's class is always loaded as long as you enabled the plugin under Admin > Plugins > Plugin Manager.
If you have other classes inside your plugin, then add require statements in the plugin's setup() function to make sure that they are loaded as well.
Enabling SQL Server in Windows

360DigiTMG Provides the Data Science Course with[…]

Hi team, Just came across this post and I am actu[…]

hola voy directo al problema Quiero generar un lin[…]

REST Light endpoints

Hi, I am using POST start-case API to create a […]