},
minimumInputLength: 1,
formatResult: CRM.utils.formatSelect2Result,
- formatSelection: function(row) {
- return _.escape((row.prefix !== undefined ? row.prefix + ' ' : '') + row.label + (row.suffix !== undefined ? ' ' + row.suffix : ''));
- },
+ formatSelection: formatEntityRefSelection,
escapeMarkup: _.identity,
initSelection: function($el, callback) {
var
markup += '<div class="crm-select2-icon"><div class="crm-icon ' + row.icon_class + '-icon"></div></div>';
}
markup += '<div><div class="crm-select2-row-label '+(row.label_class || '')+'">' +
+ (row.color ? '<span class="crm-select-item-color" style="background-color: ' + row.color + '"></span> ' : '') +
_.escape((row.prefix !== undefined ? row.prefix + ' ' : '') + row.label + (row.suffix !== undefined ? ' ' + row.suffix : '')) +
'</div>' +
'<div class="crm-select2-row-description">';
return markup;
};
+ function formatEntityRefSelection(row) {
+ return (row.color ? '<span class="crm-select-item-color" style="background-color: ' + row.color + '"></span> ' : '') +
+ _.escape((row.prefix !== undefined ? row.prefix + ' ' : '') + row.label + (row.suffix !== undefined ? ' ' + row.suffix : ''));
+ }
+
function renderEntityRefCreateLinks($el) {
var
createLinks = $el.data('create-links'),