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.
span classes for both field_prefix & field_suffix need to be changed to "input-group-addon" and wrapped in an "input-group" div.
Comment | File | Size | Author |
---|---|---|---|
#2 | field-prefix-field-suffix.patch | 2.06 KB | brian_ak |
field-prefix-field-suffix.patch | 2.03 KB | brian_ak | |
Comments
Comment #1
markhalliwellSorry to do this, but I was in the middle of #2098175: Clean up files and now the structure has completely changed (to be easier for maintaining). Please re-roll your patch against the latest HEAD. Also, be sure to read the documentation in template.php to understand what has changed. Thanks!
Comment #2
brian_ak CreditAttribution: brian_ak commentedNo prob @mark. updated patch is attached.
Comment #3
brian_ak CreditAttribution: brian_ak commentedComment #4
markhalliwellThanks @brian_ak!
Committed 313bb6e to 7.x-3.x.
Committed fec0fa5 to 7.x-3.x.
I went ahead and changed some of the logic. One must now specify
#input_group => TRUE
for it to wrap#field_prefix
and#field_suffix
with.input-group-addon
and the wrapping.input-group
div. The reason for this logic change is because there are times when one will need to specify either the prefix or suffix, but not necessary need those wrappers (and subsequent styling). An example of this would be:Comment #5
markhalliwellOn a side note, if there are certain elements in [core] forms that you think would benefit from the new
#input_group => TRUE
, create new issues to alter the forms :)Comment #6
brian_ak CreditAttribution: brian_ak commentedGreat, thanks Mark!
Comment #7
markhalliwellComment #8
heshanlkIt make sense to add field settings alter to allow #input_group in field level. So reopening.
Comment #9
heshanlkThis little work around added an option to the number and text field(text fields don't have prefix/suffix tho) and you can choose to use it with input groups. Hope this will help.
I tried to add this code to alter.inc but it didn't works and it looks like hook_form_alter doesn't look for themes it'll just search for modules.
Comment #10
markhalliwellThis would make it a feature then (since this type of functionality didn't exist before). This issue was simply about fixing the existing #field_prefix and #field_suffix properties.
Alters do work on themes, we have several form alters in Bootstrap already. The caveat though: only works if that theme is the one being used for that page request (ie: admin theme might be different). Regardless, I agree this functionality should probably be handled by a module anyhow, which is why I created https://drupal.org/project/bootstrap_ux, just for this type of thing.
Comment #11
heshanlk@Mark Carver, that's great, I'll create a patch for the UX module.
Comment #12
heshanlkFollow up #2110765: Add settings to toggle #input_group on fields in UI for more details.