hey everybody,
is there a chance to remove the dropdown to choose between "kilometer" and "miles"?
We are building a page for germany and just need "kilometer"
thanks for help
steffen
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | location-787138-18.patch | 6.7 KB | hutch |
| #16 | location-787138-16.patch | 6.44 KB | rooby |
| #14 | location-selectable-distances_2.patch | 4.62 KB | hutch |
| #11 | location-selectable-distances.patch | 4.62 KB | hutch |
Comments
Comment #1
yesct commentedtry the form_alter hook?
Comment #2
drizzi commentedhi YesCT,
thanks for the quick answer. but sorry, i am a 1-year-newby to drupal. could you pls. explain your statement?
thanks in advance
steffen
Comment #3
yesct commentedI just found form alter my self, I used it to do some cool altering of input forms. Check out api.drupal.org
http://api.drupal.org/api/function/hook_form_alter
I didnt watch this, but it might help
http://yadadrop.com/drupal-video/hook-form-alter-hook-series
Comment #4
hutch commentedIn the long term the choice of which units to show should be configurable in admin/settings/location. Most countries use the metric system and Drupal is an international project.
A function could be provided that returns an associative array built according to the config settings for use in filters etc. Coders could use the array to make select boxes or radios, whatever.
Comment #5
drizzi commentedsubscribe
Comment #6
drizzi commentedthanks again yesct,
but i am not a programmer.. hopefully there's an easier way or an update of the module including a choice.
greetings
steffen
Comment #7
hutch commentedIf the maintainer thinks this feature is worthwhile I'll have a stab at it ;-)
Comment #8
yesct commentedI dont see any reason they (the maintainers) would not include this if a patch were given. :) As long as the patch did not change anyone's current config or break any sites already out there in the wild.
Comment #9
hutch commentedI'll trace through and see where the changes need to be, apart from admin/settings/location.
Probably just the handlers.
Comment #10
drizzi commentedhi hutch,
thanks for your efforts .
best regards
steffen
Comment #11
hutch commentedHere is a patch to provide a choice:
Select box for Miles or Kilometers
Kilometers only
Miles only
This is set in admin/settings/location, the default is select box so no change there if not explicitly set
The following handlers have been altered to suit
location_views_handler_filter_proximity.inc
location_handler_sort_location_distance.inc
Please test and report back, it's important to report back, it will not be considered for commit if you don't!
Comment #12
yesct commentedmy tired brain did a quick style review, and didnt see anything glaring.
Powered by Dreditor.
As Hutch mentioned, need someone to apply the patch and try the different settings.
Comment #13
abemonkey commentedI've tried out the patch and it seems to work great for me. Thanks for doing this! I'll keep you posted if there are any issues.
Comment #14
hutch commentedRerolled the patch as there has been a commit to dev since the previous one
Comment #15
yesct commentedbrief look at the code: still looks ok to me, style good, seems to use t() well.
based on that and #13, rtbc
Powered by Dreditor.
Comment #16
rooby commentedLooks good to me.
I added the same thing to the field handler.
I'd probably rather wait until #718928: add options to set coordinates w/ user location, PHP code for field, filter is committed then reroll this patch and commit it.
Saves having to reroll the other, more complex patch if this one is committed first.
Comment #17
dwwYeah, it'd be nice to just hide this if we wanted to. Thanks for working on this! However, a few problems from a visual inspection of #16:
A) If you want to actually be using type 'radio' like this, you want
#default_valuenot#value.B) It's not clear why handlers/location_handler_field_location_distance.inc uses a radio at all -- if there's no choice, why not just use a #type 'value' element?
C) In some places, the patch changes something that used to use 'mi' for mile into 'mile'. That seems likely to potentially break existing views and/or content type definitions, no?
D) When you said you added it to the views filter, I was thinking it'd be a setting in the view filter itself as to whether or not the exposed filter should display this or not. Instead, you're making the filter honor the current site default variable. I know there's an appeal for a site-wide default, and I'd be happy to say that the views UI should default select your choice based on the current site-wide setting, but I think it's worse for views exportability if this particular behavior of the filter is controlled by a site-wide setting instead of being encoded in the view itself. I suppose you could argue the other side of it that if I'm providing a feature or a default view with a proximity search, the right units behavior to is really a localization thing, not so much the behavior of the view. But, I'm a pretty big fan of being able to export *everything* into code and keeping the behavior of the view entirely determined by the exported code for the view. Sure, I guess you could also use strongarm to be able to export this site-wide setting, it just seems odd.
Cheers,
-Derek
Comment #18
hutch commentedThe patch in #16 will no longer apply, I have re-rolled it on current CVS. Unfortunately I cannot test this ATM so if anyone has a test rig using
handlers/location_handler_field_location_distance.inc
handlers/location_handler_sort_location_distance.inc
handlers/location_views_handler_filter_proximity.inc
please test and report back to this thread so that it can be considered for commit.
Thanks.
Comment #19
jofdesign commentedThank you. It seems to work for me.
EDIT: sorry, doesn't work in fact : the requests always have no results.
Comment #20
legolasboClosing old D6 issues as D6 is end of life