I just did something similar for some data I'm exposing in Views for my custom module (it's kinda the same process no matter where views is getting its data).
To do this in the most efficient/easy way possible, you should create your own filter handler.
For a really simple example:
<?php
class custom_handler_filter_countries extends views_handler_filter_string {
/**
* Shortcut to display the exposed options form.
*/
function value_form(&$form, &$form_state) {
$form['value'] = array(
'#type' => 'select',
'#title' => t('Countries'),
'#options' => function_that_returns_options_you_want(),
);
return $form;
}
}
?>
Then, in your module's .info file, add the file containing this class (in this example, 'custom_handler_filter_countries.inc') to the .info file's files array (files[] = includes/custom_handler_filter_countries.inc
).
To make your particular view use this views handler instead of the default handler, you should be able to change the handler in hook_views_pre_view()
, I think. (On my particular site, since I defined the views data table myself, I just set my custom handler for fields that needed it. For your site, since the normal handler is already defined by Address Field, you need to override the filter handler.