I'm sure core node module has a way of doing this to get a node object from form values that's nicer than this:

  //convert returned array in to a proper object
  if ($result) {
    $node = new stdClass();
    foreach ($result as $k => $v) {
      $node->$k = $v;
    }
    return $node;
  } else {
    return false;
  }

Mostly a note to self ;)

Comments

joachim’s picture

huh.

function node_submit($node) {
  global $user;

  // Convert the node to an object, if necessary.
  $node = (object)$node;