You are here

function ajax_links_api_preprocess_html in Ajaxify Drupal with JQuery Ajax 7

Implements hook_preprocess_html().

File

./ajax_links_api.module, line 163
Make any links or create new links to load content to particular DIV via jQuery Ajax.

Code

function ajax_links_api_preprocess_html(&$variables, $hook) {
  if (isset($_GET['ajax']) && $_GET['ajax'] == 1) {
    $variables['theme_hook_suggestions'][] = 'html__ajax';

    // To override page--ajax.tpl.php for content types.
    if ($node = menu_get_object()) {
      $variables['theme_hook_suggestions'][] = 'html__' . $node->type . '__ajax';
    }

    // To override html--ajax.tpl.php for individual path.
    if ($suggestions = theme_get_suggestions(arg(), 'html')) {
      foreach ($variables['theme_hook_suggestions'] as $suggestion) {
        $variables['theme_hook_suggestions'][] = $suggestion . '__ajax';
      }
    }
    array_pop($variables['theme_hook_suggestions']);
  }
}