Hi guys
So i am writing a custom element and I am trying to add those camunda attributes in the bussinessObject, so that when I click on the element, I can have those attributes in the bussineseObject to pass that to the properties panel for modification. I added the following logics in the customElectmentfactory
but I am not sure if that’s the correct way to do this. If not, if someone can point me to the right direction.
function CustomElementFactory(bpmnFactory, moddle) {
BpmnElementFactory.call(this, bpmnFactory, moddle);
var self = this;
this.create = function(elementType, attrs) {
var type = attrs.type,
businessObject,
size;
if (/^custom\:/.test(type)) {
size = self._getCustomElementSize(type);
if (!attrs.businessObject) {
attrs.businessObject = {
$type: type,
moddle: moddle.registry.typeMap <------- I see those attributes are in there
};
}
return self.baseCreate(elementType,
assign({ type: elementType, businessObject: businessObject }, attrs, size));
}
return self.createBpmnElement(elementType, attrs);
};