You are here

function _quickedit_node_object_prepare in Quick Edit 7

Prepares a node object for editing.

Drupal 7 modules that do things upon hook_node_prepare() inappropriately assume that they're only ever going to be used on forms, which requires some additional fiddling to keep everything working correctly.

See also

node_object_prepare()

3 calls to _quickedit_node_object_prepare()
quickedit_field_node_author_edit_form in includes/node.inc
Form constructor; in-place editing form for node's 'author' "extra field".
quickedit_field_node_created_edit_form in includes/node.inc
Form constructor; in-place editing form for node's 'created' "extra field".
quickedit_field_node_title_edit_form in includes/node.inc
Form constructor; in-place editing form for node's 'title' "extra field".

File

includes/node.inc, line 231
Implements Quick Edit module hooks on behalf of node.module.

Code

function _quickedit_node_object_prepare(&$node) {
  node_object_prepare($node);

  // menu_node_save() specifically checks the presence of the "enabled" flag,
  // but menu_node_prepare() doesn't add it; it's only present in the form.
  // Hence we add it manually to ensure that when the form item is not present
  // (as is the case for single field in-place editing forms), the menu link is
  // retained instead of removed.
  if (!empty($node->menu['mlid'])) {
    $node->menu['enabled'] = TRUE;
  }
}