hook_nodeapi(&$node, 'load') should return an array

KiamLaLuno - July 19, 2008 - 16:16
Project:Nodewords
Version:6.x-1.0-rc1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Like stated in the documentation:

Return value
This varies depending on the operation.

The "presave", "insert", "update", "delete", "print" and "view" operations have no return value.
The "load" operation should return an array containing pairs of fields => values to be merged into the node object.

That is not what the module does, which uses code like:

<?php
 
case 'load':
     
$node->nodewords = _nodewords_load('node', $node->nid);
      break;
?>

#1

vladimir.dolgopolov - September 22, 2008 - 10:58

btw, path.module (a Core module!) has the same behaviour:

<?php
     
case 'load':
       
$path = 'node/'. $node->nid;
       
$alias = drupal_get_path_alias($path, $language);
        if (
$path != $alias) {
         
$node->path = $alias;
        }
        break;
?>

#2

KiamLaLuno - September 24, 2008 - 16:23

Yes, but it's a core module; if there would be a change on the way that hook is handled, the core module would be updated as well.
That is different from the case where a third party module has code that could be incompatible with future versions of Drupal; as the author of the module doesn't make new versions of the Drupal core, there would be some incompatibilities with new versions of Drupal. That is what the Drupal documentation warns about.

#3

Robrecht Jacques - February 6, 2009 - 13:58
Status:active» fixed

Fixed in CVS. Thanks!

#4

System Message - February 20, 2009 - 14:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.