please add theme hook suggestions for custom page templates

Comments

roshkovanv’s picture

I used something like this:

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';
    if ($suggestions = theme_get_suggestions(arg(), 'page')) {
      $suggestion = array_shift($suggestions);
      $variables['theme_hook_suggestions'][] = $suggestion . '__ajax';
    }
  }
}
serjas’s picture

Status: Active » Needs work

@roshkovanv , Thanks for the suggestion. You sure this will work even if we didnt copy the tpl to our theme?

roshkovanv’s picture

it will use 'page__ajax' if you don't have ex: 'page_news_ajax' template

serjas’s picture

Status: Needs work » Postponed
serjas’s picture

Can you give me one example test case , like when we need to use this?

serjas’s picture

Ignore my last comment.

With this commit , theme developer can alter page--ajax.tpl.php for particular path. For example if yoursite.com/user needed a different tpl than page--ajax.tpl.php, just create a page--user--ajax.tpl.php in your theme folder :)

Working on it now

serjas’s picture

Status: Postponed » Needs review

commited to latest 7.x-1.x-dev . Please check and give feedback

serjas’s picture

Status: Needs review » Closed (fixed)