Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
36 lines
761 B
JavaScript
36 lines
761 B
JavaScript
'use strict';
|
|
|
|
var KEYWORDS = require('./keywords');
|
|
|
|
module.exports = defineKeywords;
|
|
|
|
|
|
/**
|
|
* Defines one or several keywords in ajv instance
|
|
* @param {Ajv} ajv validator instance
|
|
* @param {String|Array<String>|undefined} keyword keyword(s) to define
|
|
* @return {Ajv} ajv instance (for chaining)
|
|
*/
|
|
function defineKeywords(ajv, keyword) {
|
|
if (Array.isArray(keyword)) {
|
|
for (var i=0; i<keyword.length; i++)
|
|
get(keyword[i])(ajv);
|
|
return ajv;
|
|
}
|
|
if (keyword) {
|
|
get(keyword)(ajv);
|
|
return ajv;
|
|
}
|
|
for (keyword in KEYWORDS) get(keyword)(ajv);
|
|
return ajv;
|
|
}
|
|
|
|
|
|
defineKeywords.get = get;
|
|
|
|
function get(keyword) {
|
|
var defFunc = KEYWORDS[keyword];
|
|
if (!defFunc) throw new Error('Unknown keyword ' + keyword);
|
|
return defFunc;
|
|
}
|