Question

I'm trying to run some custom code on a particular type of node when it is viewed. Just a little bit of code I used to implement with nodeapi. This works fine in Drupal 7, but since I am overriding the node_view page in ctools page manager it doesn't fire.

function mymodule_node_view($node, $view_mode, $langcode) {
  if($node->type=='webform') {
    drupal_set_message('test');
    // actual code will go here 
  }
}

Is there a different core function that could be used? Or a ctools page manager hook that I haven't found?

I could probably execute some code in a preprocess theme override somewhere but it doesn't feel like the best thing to do.

Was it helpful?

Solution

Beside using a preprocess function THEME_preprocess_panels_pane(), you can also use hook_ctools_render_alter().

Check out this for usage example: http://drupal.org/node/1233570#comment-4808224

Additional read:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top