[support] (no subject)

Chris Miller cjm at tryx.org
Tue Oct 29 16:03:03 UTC 2013


Hi Folks, 

I defined a call to hook_menu and I created a path "modc/ajax/%node" (see below) with the attendant callback, "modc_ajax_node($node)". I am requesting the menu entry from a view by rewriting a title field as a link: "modc/ajax/[nid]". 

So far, so good. All the plumbing works, for the most part. 

First mystery: In my callback function, modc_ajax_node($node), I expected $node to be an integer because I think I told the view to use that replacement pattern, [nid], however var_dump($node) reveals it to be a fully developed structure that, with my level of experience, I can't distinguish from the internal representation of a node, and in fact it appears to be the correct node, guessing by what I see in the fields. 

Second mystery: O.K., so let's suppose that I have an internally represented node, and I want to display it. Shouldn't: return render($node): produce a display of the page? ... because it doesn't. So, I expect I am calling the wrong thing. Can anybody tell me how I convert the internal representation of a node to the printable HTML that I need? P.S.: If my modc_ajax_node($node) callback executes: return "<P>Hi!</P>"; then I see a fully rendered page showing the title, 'Module C AJAX node callback', with content "Hi!", just as expected. 

Chris. 

...created a path to "modc/ajax/%node": 
$items['modc/ajax/%node'] = array ( 
'title' => 'Module C AJAX node callback', 
'page callback' => 'modc_ajax_node', 
'page arguments' => array(2), 
'access arguments' => array('access content'), 
'type' => MENU_CALLBACK, 
); 




 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20131029/70a75d60/attachment.html 


More information about the support mailing list