Location module - show full County name rather than County code
This is one of those easy fixes for something that can take time to figure out if you don't know where to look, I hope it's useful to someone!
The Location module allows real-world geographic locations to be associated with Drupal nodes, including people, places, and other content.
One of the fields location module provides is an auto-complete county/state/province field. This field completes to the full county name when you're creating/editing your node. Start typing "Lan" and you can select "Lancashire" but when the node is viewed only the county code is displayed "LAN". If you want the full county name to be displayed, here's what to do...
Copy the file location.tpl.php from the location module directory to your theme directory and then edit it with vi your editor of choice ;)
Look for:
if ($province) {
$city_province_postal[] = ''. $province .'';
}
and change it to:
if ($province_name) {
$city_province_postal[] = ''. $province_name .'';
}
Save, clear the cache and you should have the full county name.
I hope to find time over the weekend to document the $variables available in the location module template files. I've made a start here - http://drupal.org/node/626980
Location module version at time of writing: 6.x-3.1-rc1

Add new comment