Closed (fixed)
Project:
radix
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2014 at 20:40 UTC
Updated:
16 Aug 2016 at 15:34 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
shadcn commentedComment #2
barrapontoThis adds an implementation of `theme_input_group` and `theme_input_group_addon` to better support Bootstrap input groups (http://getbootstrap.com/components/#input-groups). It might need more of an effort if we want to support input-group checkboxes and radio controls and buttons.
Since I didn't find a use case for those, I didn't implement them. But text format is here :)
Comment #3
shadcn commentedI like this idea. But I'm dunno if input format is the best place to use this. It is looking a bit weird with the dropdown.
Comment #4
barrapontoFirefox and Chrome in my Arch Linux running Gnome... it looks like this.
Comment #5
barrapontoComment #6
barrapontoComment #7
dsnopekSome quick review of the patch:
This bit of code will only work on PHP 5.3 or greater.
While most people are probably on PHP 5.3 or greater, Drupal 7 officially supports 5.2.5 or greater. So, either this bit of code will need to be changed OR we need to add 'php = 5.3' to the radix.info file.
I think these should be called 'radix_input_group' and 'radix_input_group_addon' to match the other theme functions declared uniquely by Radix (and not from some other module).
Comment #8
dsnopekHere's a new patch that addresses my review from above. Also, I noticed that this patch has a negative accessibility impact from this bit of code:
This removes the label and it's relationship to the input.
Assigning this to me - I'm going to hack on this for a bit and see if I can fix this!
Comment #9
dsnopekAlright, here is a patch that addresses the accessibility issue by allowing you specify
'#title_display' => 'input-group-before'and it'll put the title label into the input group. This requires a minor style change in compass_radix to remove the margin from labels inside .input-group-addon's:https://github.com/arshad/compass_radix/pull/17
However, this approach makes me wonder if we shouldn't bake support for input groups right into
radix_form_element()? We could add a'#input_group' => TRUEthat would render the prefix/suffix into a Bootstrap input group, and support the same'#title_display' => 'input-group-before' / 'input-group-after'that's in my patch? That way, we can easily turn any form element into an input group but WITHOUT losing any of the functionality ofradix_form_element()(which does more stuff thantheme_radix_input_group()).Anyway, not sure if that makes sense...
Comment #10
dsnopekHere's a re-roll of this patch for the latest 7.x-3.x, including the changes that used to be in the PR against the compass gem. This is untested, but I'll get to that soon!
My question about approach #9 is still relevant (I'll think about that again after I test this), but the functionality itself is pretty sound - I've been using it with client sites for over a year.
Comment #11
dsnopekIt worked in my testing with latest 7.x-3.x! Marking as "Needs work" to deal with #9
Comment #12
dsnopekOk, here's a new version of the patch that addresses the question (from myself) in #9.
Rather than providing a new theme wrapper that you can swap in, it integrates the changes directly into
radix_form_element(). It allows you to do something like:As you can see, there's now
'#input_group' => TRUEwhich will cause it to use a Bootstrap input group for the '#field_prefix' and '#field_suffix'.Then it also adds some non-standard values for the '#title_display' attribute: 'prefix' and 'suffix', which will basically put the title into the '#field_prefix' or '#field_suffix' respectively.
Used together, you can make a Bootstrap input group which has the field title as the prefix, which we use on the text format selector!
Anyway, the effect is the same, but I'm much happier with this patch than the original. :-) But it could still use some more testing and review!
Comment #13
dsnopekThe last patch had some left-over code from the old approach that's no longer necessary! Here's an updated patch that just removes that code, that isn't even used anyway in the new approach. So, smaller patch, same effect!
Comment #14
shadcn commentedDavid, if all good here, please go ahead and commit this one as well. Thanks.
Comment #16
dsnopekYeah, all my code concerns are now addressed and this has been working in my testing for a couple weeks now. So, committed! :-)