Answer the question
In order to leave comments, you need to log in
How to deal with the javascipt construct in Bitrix?
Good afternoon I'm
just starting to understand javascript and have the following question:
In the sale.order.ajax component, the order_ajax.php file has the following construction:
createBasketItemImg: function (data) {
if (!data)
return;
var logoNode, logotype;
logoNode = BX.create('DIV', { props: { className: 'bx-soa-item-imgcontainer' } });
if (data.PREVIEW_PICTURE_SRC && data.PREVIEW_PICTURE_SRC.length)
logotype = this.getImageSources(data, 'PREVIEW_PICTURE');
else if (data.DETAIL_PICTURE_SRC && data.DETAIL_PICTURE_SRC.length)
logotype = this.getImageSources(data, 'DETAIL_PICTURE');
if (logotype && logotype.src_2x) {
logoNode.setAttribute('style',
'background-image: url(' + logotype.src_1x + ');' +
'background-image: -webkit-image-set(url(' + logotype.src_1x + ') 1x, url(' + logotype.src_2x + ') 2x)'
);
}
else {
logotype = logotype && logotype.src_1x || this.defaultBasketItemLogo;
logoNode.setAttribute('style', 'background-image: url(' + logotype + ');');
}
if (this.params.HIDE_DETAIL_PAGE_URL !== 'Y' && data.DETAIL_PAGE_URL && data.DETAIL_PAGE_URL.length) {
logoNode = BX.create('A', {
props: { href: data.DETAIL_PAGE_URL },
children: [logoNode]
});
}
return BX.create('DIV', {
props: { className: 'bx-soa-item-img-block' },
children: [logoNode]
});
},
Answer the question
In order to leave comments, you need to log in
Bitrix has nothing to do with it, and so this piece is taken out of context.
It's most likely just a property of the object :
var obj = {
foo: 'bar',
createBasketItemImg: function(data) {...}
}
obj.createBasketItemImg();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question