[support] Trying to not hack core.

Earnie Boyd earnie at users.sourceforge.net
Mon Oct 8 21:31:25 UTC 2012


On Mon, Oct 8, 2012 at 5:25 PM, Pat Newberry wrote:
> On 10/8/2012 5:21 PM, Earnie Boyd wrote:
>> On Mon, Oct 8, 2012 at 3:45 PM, Pat Newberry wrote:
>>> 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.
>> Have you cleared the caches?  admin/config/development/performance
>>
>>> 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.
>> Perhaps another hook.  Have you looked at drupal.org/project/location?
>>   Do you know about api.drupal.org?
>>
> I have cleared  caches, I can tell that because my changes to the
> existing countries takes affect in the drop down list on the search page.
>
> I'll check out another hook. I initially tried and that is where I came
> up with the countries_alter hook as shown above. I'll do a second pass
> and see if another seems like it might fit.

You may want to check the views specific hooks.  http://api.drupal.org/api/views

-- 
Earnie
-- https://sites.google.com/site/earnieboyd


More information about the support mailing list