Closed btopro closed 6 years ago
getHaxJSONSchema: function(type, haxProperties, target = this) {
if (typeof type === typeof undefined) {
type = 'configure';
}
if (typeof haxProperties === typeof undefined) {
haxProperties = target.haxProperties;
}
var slot = '';
let settings = haxProperties.settings[type];
var schema = {
'$schema': 'http://json-schema.org/schema#',
'title': 'HAX ' + type + ' form schema',
'type': 'object',
'properties': {}
};
schema.properties = this._getHaxJSONSchemaProperty(settings, target);
// support post processing of schema in order to allow for really
// custom implementations that are highly dynamic in nature
if (this.postProcessgetHaxJSONSchema === 'function') {
schema = this.postProcessgetHaxJSONSchema(schema);
}
return schema;
},
postProcessgetHaxJSONSchema
can now be implemented in order to manipulate the schema right before it goes back out to HAX for handling
Especailly w/ the
cms-token
stuff we'll need a way to provide links to open in new windows / window.postMessage sorta stuff in order to correctly work with UIs and capabilities too complex for the current haxBehaviors stuff to account for (such as clicking to need to modify the underlying title to what's being presented as a remotely rendered piece of media).While a better solution is the postMessage stuff, if we just support the ability to render a prefix and suffix area via the schema then we'll be able to support this bridge pretty easily. Let's do the callback based method instead of hardcoded output this way the element has finer control over what's presented (in the case of a token it would strip off the id of the node and then build a link to the correct thing dynamically).