[development] node object in hook_block?
ber at webschuur.com
Tue Jul 4 15:02:40 UTC 2006
Op dinsdag 4 juli 2006 15:54, schreef Gabor Hojtsy:
> 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.
Maybe, yes. I am not a fan of mixed return types. I know PHP is rather liberal
about that but I too often found myself cornered because I did a foreach on
some return value, only to find out that some ugly coded (IMO) function
returns a FALSE of an ARRAY(). ugh.
I think a set of such helper modules might be a better plan. I named this
function is_node_page (*is*) on purpose, it is a test.
in addition something like find_page_node_id() or even get_page_node() etc
could be other handy modules.
More information about the development