Customization
hook_apachesolr_ajax_modules_alter()
If you have a module that defines custom blocks for the apachesolr module, you need to let apachesolr_ajax know about it. (If you don't, apachesolr_ajax won't return the HTML for those blocks in its AJAX response.) Do this by implementing the following hook:
function MYMODULE_apachesolr_ajax_modules_alter(&$modules) {
$modules[] = 'mymodule';
}
MYTHEME_apachesolr_ajax_js()
If you want to substitute your own JavaScript and CSS files for those used by this module, implement MYTHEME_apachesolr_ajax_js(). Here is the default implementation of theme_apachesolr_ajax_js():
function theme_apachesolr_ajax_js() {
$head = drupal_get_html_head();
foreach (array(
'http://yui.yahooapis.com/2.8.0r4/build/yahoo/yahoo-min.js',
'http://yui.yahooapis.com/2.8.0r4/build/event/event-min.js',
'http://yui.yahooapis.com/2.8.0r4/build/history/history-min.js') as $script) {
if (strpos('<script src="'. $script .'"></script>', $head) === FALSE) {
drupal_set_html_head('<script src="'. $script .'"></script>');
}
}
drupal_add_js(drupal_get_path('module', 'apachesolr_ajax') .'/apachesolr_ajax.js', 'module', 'footer');
drupal_add_css(drupal_get_path('module', 'apachesolr_ajax') .'/apachesolr_ajax.css');
}
Note that, if you want to replace some of the functionality within apachesolr_ajax.js, you may do so by overriding its functions. For example, you may override Drupal.apachesolr_ajax.ajax to AJAX-ify links that this module is unaware of.
hook_apachesolr_ajax_enable()
If you want to enable this module on pages other than "search/apachesolr_search", implement this hook, and have it return TRUE for any additional page on which you want to enable this module:
function MYMODULE_apachesolr_ajax_enable() {
return $_GET['q'] == 'path/on/which/to/enable/search';
}
hook_apachesolr_ajax_disable()
If you want to disable this module on some pages, implement this hook, and have it return TRUE for any page on which you want to disable this module:
function MYMODULE_apachesolr_ajax_disable() {
return $_GET['q'] == 'path/on/which/to/disable/search';
}
MYTHEME_apachesolr_ajax_yui()
It is unlikely you will ever need to change the markup for Yahoo!'s Browser History Manager, but in case you do, you may change it by implementing MYTHEME_apachesolr_ajax_yui(). Here is the default implementation of theme_apachesolr_ajax_yui():
function theme_apachesolr_ajax_yui($src = '/robots.txt') {
return '<iframe id="yui-history-iframe" src="'. $src .'"></iframe><input id="yui-history-field" type="hidden">';
}
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion