Drupal 7: page / panel manager and hook_node_view

I am trying to run some kind of custom code for a certain type of node while viewing it. Just a little code that I used to implement with nodeapi. This works fine in Drupal 7, but since I override the node_view page in the ctools page manager, it does not work.

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

Is there any other key feature that can be used? Or a ctools page manager hook that I did not find?

I could probably execute some code in the preprocess, redefine the topic somewhere, but it doesn't feel the best.

+6
source share
1 answer

Besides using the preprocess function THEME_preprocess_panels_pane () , you can also use hook_ctools_render_alter () .

Have a look at a usage example: http://drupal.org/node/1233570#comment-4808224

Additional reading:

+4
source

Source: https://habr.com/ru/post/888536/


All Articles