[development] node object in hook_block?

Gabor Hojtsy gabor at hojtsy.hu
Tue Jul 4 13:54:39 UTC 2006


Wouldn't it be better to also return arg(1), making it a mixed return 
value? The node id (evaluates to true) on sucess, FALSE on failure. Since 
it already does the check, it is just logical to return the nid.

Goba

On Mon, 3 Jul 2006, [iso-8859-1] Bèr Kessels wrote:
> 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