Looking for some advice. My Drupal background is quite limited,
but I'll do my
best to use the correct terminology.
Basically we have a view that is used to search for
organizations based on the
country.
So when I go to the view for the search page and click on the
configure filter
criterion, I see a series of check boxes associated with the
field_address:county field that is a long list of countries.
The values for the countries appears to come from the file:
includes/iso.inc
What I'm trying to do is change some of the names, plus add one
or two
countries.
The reason for this is this search is based on where our
organization works.
For example we have a separate organization in Northern Ireland.
Of course this
is not listed in the ISO.inc file.
I was not able to figure out how the ISO.inc values are tied to
the
field_address_country, but they are.
My first instinct was to, heck, just modify the ISO.inc file.
But then I was
told that was bad because that is like hacking core.
After some Google searching I found I could add to a function
Hook to an
existing custom module that deals with forms (written by 3rd
party) with a hook
for countries alter.
function myCustomMod_countries_alter(&$countries) {
$countries['IE'] = 'Republic of Ireland-xx';
$countries['GB'] = 'Great Britain';
$countries['RU'] = 'Russian Federation';
$countries['CI'] = 'Cote d\' lvoire';
$countries['BA'] = 'Bosnia Herzegovina';
$countries['NN'] = 'Northern Ireland';
}
Now when I go to the view, this has no effect on the list of
countries, but
when I go to the search page that uses this view with exposed
criteria and
form, I can see that the countries that exist in the iso file
(e.g. Republic of
Ireland with an -xx) are modified with my changes from the
countries_alter hook, but the
countries that do not exist in the iso file are not added (e.g.
Northern
Ireland). I am guessing at the time the exposed search drop down
list is built,
it has my changes in it (altered and added) but that it checks
against the
values that are checked in the view and if it's not check in the
view, it won't
get added to the list.
So looking for advice as to what direction I should head.
1.) Hack the ISO.inc file.
2.) learn how to attach another .inc file to the
field_address:country
3.) another hook or code in the hook alter that will work when
the form is
rendered.
Pat.