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.
I haven't done much in the way of styling our new proximity widget. It desperately needs it. Specifically, we should shorten the lengths of our text fields via css, ensure everything gets displayed inline, and come up with a sane way to render our lat/lon widget inline, probably by hiding/not rendering the fieldset around our two inputs.
Comment | File | Size | Author |
---|
Comments
Comment #1
welly CreditAttribution: welly commentedWhat would be great is if the distance widget could be defined as a select box (or textfield). Unless there's a hook that will allow me to do this?
Comment #2
welly CreditAttribution: welly commentedJust further to this, I've tried styling the widget using theme_geofield_proximity as follows:
However, I'm not having much joy in the textfield being turned into a select field. Any advice?
Thanks
Comment #3
caktux CreditAttribution: caktux commentedComment #4
Jason Dean CreditAttribution: Jason Dean commentedHey thanks caktux - saved my day :)
Comment #5
dave.erwin CreditAttribution: dave.erwin commentedyes, that code was a lifesaver, I needed to rearrange the distance and origin and add some labels as well
Comment #6
sonixax CreditAttribution: sonixax commentedHi,
Is it possible to use Combo-Box or EditableFields instead of Select in geofield ?
I want to have a editable Dropdown box, which users can input their custom values too!
For example have a list of cities :
Berlin
Hannover
Hamburg
etc ...
users can select the cities, but also the should be able to type postal code in dropdown too!
like what ebay classifieds already have!
Thanks a lot :)
Comment #7
johnhanley CreditAttribution: johnhanley as a volunteer commentedThis is an old thread, but still super useful. Thanks caktux and dave.erwin.
BTW, it's useful to add a default value attribute:
$element['distance']['#default_value'] = '25';
Also the zip code text field size can be tightened up:
$element['origin']['#size'] = '15';
Comment #8
fehin CreditAttribution: fehin commentedI want to change the position (weight?) of the zipcode form to come before the distance operator. I tried the code below but it didin't work.
Comment #9
johnhanley CreditAttribution: johnhanley as a volunteer commented@fehin, make origin "heavier" with a negative number:
Comment #10
fehin CreditAttribution: fehin commentedI tried that. It doesn't make a difference.
Comment #11
johnhanley CreditAttribution: johnhanley as a volunteer commentedI'm successfully using the aforementioned technique so there must be something else skewing the element weights.
Comment #12
fehin CreditAttribution: fehin commentedI'm using it with views search. Could that be the problem?
It looks like this:
Comment #13
johnhanley CreditAttribution: johnhanley as a volunteer commentedWhat's the $element array look like when you examine the weight attributes for each of your fields?
In my case I also have 3 exposed filter fields: origin, distance and a taxonomy. I adjusted the order in Views so the taxonomy is last and then swapped the order of distance and origin using hook_proximity_element_process(). Easy peasy lemon squeezy.
Comment #14
fehin CreditAttribution: fehin commentedI modified the views exposed form template. I removed parts that I didn't need and I moved the views-operator class below views-widget class and that solved it.