nodeapi not called for custom node path?

celadon - December 29, 2008 - 18:41

I have created a couple of modules to display custom node types on my site. I added menu hooks so the content can be displayed with a custom path (e.g. "chapters/%/view" instead of "node/%"). However, when the content is called using the custom path it seems like nodeapi is not getting called properly or something - for example, the Service Links module does not add its links to the node. When I view the content using the regular node path, the Service Links show.

Is there something special I need to do to make sure my content gets registered as a node and triggers all of the correct node-building steps when it is called via a custom path?

thanks

Make sure you've followed the code

nedjo - December 29, 2008 - 21:23

in node_menu() and you should get most of what you want.

<?php
  $items
['chapters/%node'] = array(
   
'title callback' => 'node_page_title',
   
'title arguments' => array(1),
   
'page callback' => 'mymodule_page_view',
   
'page arguments' => array(1),
   
'access callback' => 'node_access',
   
'access arguments' => array('view', 1),
   
'type' => MENU_CALLBACK);
 
$items['chapters/%node/view'] = array(
   
'title' => 'View',
   
'type' => MENU_DEFAULT_LOCAL_TASK,
   
'weight' => -10);
?>

However, some modules may be testing for arg(0) == 'node' and hence skipping your pages.

thanks, but not quite there.

celadon - December 30, 2008 - 02:19

thanks, but not quite there.

My menu hook wasn't just like that, but I changed it and I'm still getting the same results. Another example is that the nodewords module is not adding the node-specific meta tags when addressed by "chapters/%" but it does for "node/%."

Obviously, I am not exactly clear on how my module's view code is integrated into the node-building process.

It seems like my menu page callback is not getting called at all - I tried putting in "node_page_view" as the callback instead of "chapter_page_view" and the results were identical. It is clear that my hook_view() function is getting called whether the path is "node/%" or not... and the node module is obviously loading the rest of the node object either way... but the node_view() function is not getting called (which is where nodeapi is invoked).

Any other tips or suggestions?

thanks

Similar problem for me

luca3003 - March 17, 2009 - 14:12

I created a new module to display a customized view of some node.
but typing the path q=fashionnews I see the content provided by node_page_default() instead of the one provided by the callback of my module.

What I, see tracking the callback procedure, is that my callback function is regularly called but immediatly after is called the node_page_default() which overrides the content previously provided by the other callback.

My question is 'why'?
Is there anything I misunderstood?

thank you very much

 
 

Drupal is a registered trademark of Dries Buytaert.