(function ($) { Drupal.behaviors.features_override_form = { attach: function(context, settings) { $('#edit-sources-features-overrides:not(.features-override-processed)', context) .prepend(Drupal.t('Advanced usage only. Allows you to select individual changes only to export.')) .addClass('features-override-processed'); $('input[type=checkbox][name^="sources[features_override_items]"]:not(.features-override-form-processed)', context).each(function (i) { var $parent_checkbox = $(this); $parent_checkbox.addClass('features-override-form-processed'); var $parent_label = $parent_checkbox.parent().find('label'); // Create a link that links to the exact differences from the label. if (Drupal.settings.features_override_links['main'][this.value]) { $parent_label.append('' + Drupal.t('view') + ''); } var $child_checkboxes = $('input[type=checkbox][name^="sources[features_overrides]"][value^=' + this.value + ']').each(function (i) { if (Drupal.settings.features_override_links['sub'][this.value]) { $($(this).parent()).find('label').append('' + Drupal.t('view') + ''); } }).parents('div.form-type-checkbox'); $child_checkboxes.wrapAll('
'); var $wrapper = $child_checkboxes.parent(); // Prepend a label saying what these overrides are for. $wrapper.before('