Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal 7: page manager/panels and hook_node_view

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.

like image 717
joevallender Avatar asked May 19 '11 12:05

joevallender


1 Answers

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()

like image 61
aminalid Avatar answered Sep 21 '22 11:09

aminalid