[development] node object in hook_block?

Gabor Hojtsy gabor at hojtsy.hu
Wed Jul 5 08:03:27 UTC 2006

On Tue, 4 Jul 2006, [iso-8859-15] Bèr Kessels wrote:

> 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.

Right, keeping the name and changing the behaviour to return the $nid 
would mislead developers.


More information about the development mailing list