+ if (options === 'destroy') {
+ return $(this).each(function() {
+ var entity = $(this).data('api-entity') || '';
+ $(this)
+ .off('.crmEntity')
+ .removeClass('crm-form-entityref crm-' + entity.toLowerCase() + '-ref')
+ .crmSelect2('destroy');
+ });
+ }