function ajax_links_api_preprocess_page in Ajaxify Drupal with JQuery Ajax 7
Same name and namespace in other branches
- 6 ajax_links_api.module \ajax_links_api_preprocess_page()
Implements hook_preprocess_page().
File
- ./
ajax_links_api.module, line 143 - Make any links or create new links to load content to particular DIV via jQuery Ajax.
Code
function ajax_links_api_preprocess_page(&$variables) {
// This is used to display only $content.
if (isset($_GET['ajax']) && $_GET['ajax'] == 1) {
$variables['theme_hook_suggestions'][] = 'page__ajax';
// To override page--ajax.tpl.php for content types.
if (isset($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type . '__ajax';
}
// To override page--ajax.tpl.php for individual path.
if ($suggestions = theme_get_suggestions(arg(), 'page')) {
foreach ($variables['theme_hook_suggestions'] as $suggestion) {
$variables['theme_hook_suggestions'][] = $suggestion . '__ajax';
}
}
array_pop($variables['theme_hook_suggestions']);
}
}