4

What is the purpose of $node->data? the Node object reference has $node->date, which used for

Long date, including timezone data, of when the node was created.

May I use $node->data to store my own temporary variables?

  • How temporary is temporary? Do they need to be saved to the DB at any point? – Citricguy Jul 9 '12 at 3:07
  • In what context are you adding to $node->data? I wouldn't recommend using it as a container for any temporary variables, why not store those variables somewhere else, what brings about the necessity for using $node->data? – Daniel Waters Jul 22 '13 at 11:48
2

According to this page $node->data was used about Drupal 5 and is left there for legacy purposes only. It appears it's only purpose is to prevent "call to undefined property" errors. Do not use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.