Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Current output:
<div class="form-item form-type-checkbox form-item-field-some-field-name-und-0-field-remove-item">
<input type="checkbox" id="edit-field-some-field-name-und-0-field-remove-item" name="field_some_field_name[und][0][field_remove_item]" value="1" class="form-checkbox ajax-processed"> <span class="field-suffix">Remove</span>
</div>
The outer <div>
could really use an additional class like "form-item-remove-item-checkbox" so that we can style these, especially since they're default display doesn't necessarily work well alongside the fields they're removing.
Comments
Comment #1
charlie-s CreditAttribution: charlie-s commentedSomething as simple as adding a #prefix and #suffix to the $element in
field_remove_item_field_widget_form_alter()
does the trick for me:but it might be best to add a single class to this element's wrapper, and I don't know how to target a form element's wrapper without implementing custom theme functions for an element type. In this case that's 'checkbox' and I would think it overkill to change the type of this element to "field_remove_item_checkbox" and implement a custom theming function.
Comment #2
pcambraMarking this as a dupe of #2242823: Add unique css class to Remove Button as the widget is now a button.