Hi there,

I have had a look through api.drupal.org, but haven't been able to find an explanation of the $node object that is passed to many hooks. Is there prewritten documentation on the properties, or do I need to dump one out in code?

Comments

jhodgdon’s picture

Title: Documentation on $node object » Documentation on $node object is missing

The properties definitely depend on which modules you have enabled... but we could/should probably document the standard/core parts of it. See also #630826: Document which properties are available in user objects..

Basically, we could probably use some overall documentation on $user and $node objects, and maybe some others?

Scott J’s picture

Here is an overview of the node object for Drupal 5 and Drupal 6:
Node object reference

kahunacohen’s picture

Should this be closed, given that this documentation apparently exists? Should I close it?

jhodgdon’s picture

Version: 6.x-dev » 7.x-dev

The referenced doc is not on api.drupal.org, so no I don't think it should be closed. Probably should be marked as 7.x though.

giorgio79’s picture

jhodgdon’s picture

There's another issue for $user. Let's keep this one focused on $node.

gilzero’s picture

subscribe, also looking for D7 $node reference.

damien tournoud’s picture

I would suggest the following course of action:

  • Document the basic object structure in entity_load(), including the field structure for fieldable entities
  • Add a reference to entity_load() to the *_load() functions for the six core entities (node, comment, user, file, taxonomy term, taxonomy vocabulary)
  • Add a group for the hook_*_load() for the six entities
  • Add a reference to that group to the *_load() functions

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.