parse: function() { var value = this.$data_field.val(), data = !_.isEmpty(value) ? $.parseJSON(value) : []; if(_.isEmpty(value)) { data = [{link: "post", name: "title"}, {name: 'image'}, {name: 'text'}]; this.$data_field.val(JSON.stringify(data)); } _.each(data, function(block_data){ if(_.isString(block_data.name) && block_data.name.indexOf('{{') < 0) { var $control = $('.vc_teaser-btn-' + block_data.name, this.$toolbar).prop('checked', true); if(block_data.name == 'image' && !_.isUndefined(block_data.image)) { if(block_data.image !== 'featured') { this.custom_image_attributes = {id: block_data.image}; block_data.mode = 'custom'; } else { block_data.mode = 'featured'; } } else if(block_data.name == 'text') { if(block_data.mode === 'custom') { this.custom_text = block_data.text; } } this.createControl(block_data); this.$spinner.hide(); } }, this); this.$spinner.hide(); }