Questions and discussion about using ProcessMaker: user interface, running cases & functionality
User avatar
By jemiris
#824849
Hi,

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 :?:
#824873
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') {
    $("#myButton").show();
}
else {
    $("#myButton").hide();
}
#824875
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 :?:
#824891
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
#824898
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 :?:
#824918
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';
else
   $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.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]