5

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.

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
joevallender
  • 4,293
  • 3
  • 27
  • 35

1 Answers1

4

Beside using hook_preprocess_panels_pane(), you can also use hook_ctools_render_alter().

Check out Meta tags never rendered when using Panels for an example.
See also Document the amazing hook_ctools_render_alter()

apaderno
  • 28,547
  • 16
  • 75
  • 90
aminalid
  • 1,156
  • 10
  • 7