[development] node object in hook_block?

Bèr Kessels ber at webschuur.com
Mon Jul 3 08:49:12 UTC 2006


Op zaterdag 1 juli 2006 09:54, schreef Augustin (a.k.a. Beginner):
> if (arg(0) == 'node' && is_numeric(arg(1)))
> but it looks like a hack and for what I have in mind, it makes things more
> complicated.

This is the current way of doing that. And since that specific line is 
repeated all over Drupal and its contribs, I just added it to helpers.module:
 
/**
 * Find out if the current page is a node page.
 * @return TRUE if the page is a node, FALSE if it is another page.
 */
function is_node_page() {
 if (arg(0) == 'node' && is_numeric(arg(1))) {
   return TRUE;
 }
 return FALSE;
}

Bèr


More information about the development mailing list