You are here

README.txt in Search API ajax 7

Ajaxify Search API pages.

INSTALLATION AND CONFIGURATION

This Ajax module does not understand your theme CSS id's by default. You must
implement a custom module hook to let it know about your theme.
 
For example, create and enable a custom mymodule.module containing this code:

<?php
/**
 * Implements hook_search_api_ajax_settings().
 */
function mymodule_search_api_ajax_settings() {
  $settings = array(
  
    // CSS id for main content (search results html)
    // format: content => CSS id
    'content' => '#content .content',
    
    // CSS id's for regions containing search blocks
    // check your region names in mytheme.info
    // format: region_name => CSS id
    'regions' => array(
      'sidebar_first' => '#sidebar-first',
      'sidebar_second' => '#sidebar-second',
    ),

    // OPTIONAL: if you want to decide which regions links are
    // AJAXified. Will allow you to have links in the search result
    // that have the same base URL for the search.
    facet_locations = '#sidebar-first';

    // OPTIONAL: if you want to provide an AJAX spinner
    // this paht is for a default spinner path provided with this module
    // @note: see the search_api_ajax.css
    'spinner' => drupal_get_path('module', 'search_api_ajax') .'/spinner.gif',
    
    // OPTIONAL: if you want to use scroll-to-top functionality when paging
    // scroll target div
    'scrolltarget' => '#main-content',
    'scrollspeed' => 1000,
    
    // OPTIONAL: if you want to fade search results when Ajaxing
    // please set to 1 for TRUE
    'fade' => 1,
    'opacity' => 0.3,    
  );
  
  return $settings;
}

ADDING MODULES' BLOCKS TO THE AJAX SYSTEM

If you want your third party modules blocks to show up in the AJAX JSON,
then you need to register them with a custom function:

@see function search_api_ajax_modules() (default modules are included)

/**
 * Implements hook_search_api_ajax_modules_alter().
 *
 * Add custom modules to search api ajax blocks.
 */
function mycustommodule_search_api_ajax_modules_alter(&$modules) {
  $modules[] = 'custom_module';
}

File

README.txt
View source
  1. Ajaxify Search API pages.
  2. INSTALLATION AND CONFIGURATION
  3. This Ajax module does not understand your theme CSS id's by default. You must
  4. implement a custom module hook to let it know about your theme.
  5. For example, create and enable a custom mymodule.module containing this code:
  6. /**
  7. * Implements hook_search_api_ajax_settings().
  8. */
  9. function mymodule_search_api_ajax_settings() {
  10. $settings = array(
  11. // CSS id for main content (search results html)
  12. // format: content => CSS id
  13. 'content' => '#content .content',
  14. // CSS id's for regions containing search blocks
  15. // check your region names in mytheme.info
  16. // format: region_name => CSS id
  17. 'regions' => array(
  18. 'sidebar_first' => '#sidebar-first',
  19. 'sidebar_second' => '#sidebar-second',
  20. ),
  21. // OPTIONAL: if you want to decide which regions links are
  22. // AJAXified. Will allow you to have links in the search result
  23. // that have the same base URL for the search.
  24. facet_locations = '#sidebar-first';
  25. // OPTIONAL: if you want to provide an AJAX spinner
  26. // this paht is for a default spinner path provided with this module
  27. // @note: see the search_api_ajax.css
  28. 'spinner' => drupal_get_path('module', 'search_api_ajax') .'/spinner.gif',
  29. // OPTIONAL: if you want to use scroll-to-top functionality when paging
  30. // scroll target div
  31. 'scrolltarget' => '#main-content',
  32. 'scrollspeed' => 1000,
  33. // OPTIONAL: if you want to fade search results when Ajaxing
  34. // please set to 1 for TRUE
  35. 'fade' => 1,
  36. 'opacity' => 0.3,
  37. );
  38. return $settings;
  39. }
  40. ADDING MODULES' BLOCKS TO THE AJAX SYSTEM
  41. If you want your third party modules blocks to show up in the AJAX JSON,
  42. then you need to register them with a custom function:
  43. @see function search_api_ajax_modules() (default modules are included)
  44. /**
  45. * Implements hook_search_api_ajax_modules_alter().
  46. *
  47. * Add custom modules to search api ajax blocks.
  48. */
  49. function mycustommodule_search_api_ajax_modules_alter(&$modules) {
  50. $modules[] = 'custom_module';
  51. }