for my content type I have this computed field code and when I update existing node everything is ok, but when I create new node, menu_get_object return empty values and drupal display this error message "EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7562 of /var/www/dev/testpage/includes/common.inc)." and nothing was saved. When I used dpm() in devel it show me that after creating new content $node is empty, but when I update node created before everything is OK.

$node = menu_get_object();
$start_time = field_get_items('node', $node, 'field_start_time');
$start_time = $start_time[0]['value'];
$entity_field[0]['value'] = '$start_time';

thanks a lot for your reply

1 Answer 1


menu_get_object() provides access to objects loaded by the current router item. For example, on the page node/%node, the router loads the %node object, and calling menu_get_object() will return that.

From: http://api.drupal.org/api/drupal/includes!menu.inc/function/menu_get_object/7

It returns empty upon creation because you add the node from "node/add/[content-type]" page but update it from "node/[nid]" and it can use the nid to load the node.

If you need just to duplicate the value from the start_time field of the same node, use this:

$entity_field[0]['value'] = $entity->field_start_time[0]['value'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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