0

I sense this can be done with Context etc, but it doesn't feel right to issue a few more modules for the job of a few lines of code.

Something like the following has to fit this:

function mytheme_omega_layout_alter(&$layout) {
  if (arg(0) == 'node' && is_numeric(arg(1)) 
      && $node = node_load(arg(1)) && $node->type == 'article') {
    $layout = 'article';
  }
  else if ($view = views_get_current_view() && $view
      && $view->name == 'term_content' && $view->current_display == 'term_page') {
    $layout = 'term_page';
    print '<pre>';
    print_r($view);
    print '</pre>'; 
  }
}

The problem here is, views_get_current_view() looks like it doesn't play well in this hook. I couldn't find any documentation.

I'll send best of my karma-pack to any contribution:) Cheers!

1 Answer 1

0

Wow wow, little bit syntax failure with the wrong function caused a disturbance in the force.

Here is how:

function mytheme_omega_layout_alter(&$layout) {
  if (arg(0) == 'node' && is_numeric(arg(1)) 
      && $node = node_load(arg(1)) && $node->type == 'article') {
    $layout = 'article';
  }
  else if (($view = views_get_page_view()) 
        && $view->name == 'term_content' && $view->current_display == 'term_page') {
    $layout = 'term_page';
  }
}

PS: This is going to the community wiki as the internets don't have an answer about it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.