mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-16 18:26:06 +01:00
start of new forms implementation
This commit is contained in:
20
themes/grav/js/forms.js
Normal file
20
themes/grav/js/forms.js
Normal file
@@ -0,0 +1,20 @@
|
||||
$(function () {
|
||||
|
||||
if (typeof window.GravJS === 'undefined' || !window.GravJS.Form) {
|
||||
console.warn('Dependencies for Grav Forms are not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Register all FormFields that were loaded
|
||||
if (typeof window.GravJS.FormFields === 'object') {
|
||||
for (var key in window.GravJS.FormFields) { if (window.GravJS.FormFields.hasOwnProperty(key)) {
|
||||
GravJS.Form.registerFactory(GravJS.FormFields[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.formInstances = [];
|
||||
$('[data-grav-form]').each(function () {
|
||||
window.formInstances.push(new GravJS.Form($(this)));
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user