Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Scripts that is used within the plugin is located in the ResursBank\Module\Data class.

VariableScript description
$jsLoaders
Default loaders that is usually added to the user sections for WordPress.
$jsLoadersCheckout
Scripts that is only loaded in the head, at checkout section.
$jsLoadersAdmin
Script loaded in the admin section.
$jsDependencies

Every script that has dependencies in other scripts should be added here. For example if some of the basic scripts needs jquery it is added like this:

Code Block
themeEmacs
private static $jsDependencies = ['resursbank' => ['jquery']];


$jsDependenciesAdmin
As the regular dependency variable above, but for admin section.
$styles
Every css that needs to be loaded.
$stylesAdmin
Css that resides in the admin section.

Default scripts

The built in colleciton of scripts provides a few scripts for handling the basic calls of the plugins. The bundled scripts are listed below.

ScriptDescription
js/resursbank.jsDefault front page script. Customer based non admin.
js/resursbank_admin.jsAdmin (wp-admin) based scripts. Nothing peculiar actually, it's just code that doesn't have to be used in the front to save performance, etc.
js/resursbank_global.js

Global script. Loaded both with admin and front page. Contains amongst others an ajaxfier.

We could create separate ajax calls for each thing we'd like to do, but that will in the end cost more space and the calls may look different each time they are used. I don't see why we would need that.

See below in the AJAX calls section how this works.

AJAX calls