1 node.pages.inc node_form_submit_build_node($form, &$form_state)

Updates the form state's node entity by processing this submission's values.

This is the default builder function for the node form. It is called during the "Save" submit handler to retrieve the entity to save. This function can also be called by a "Next" button of a wizard to update the form state's entity with the current step's values before proceeding to the next step.

See also





core/modules/node/node.pages.inc, line 807
Callbacks for adding, editing, and deleting content and managing revisions.


function node_form_submit_build_node($form, &$form_state) {
  // @todo Legacy support for modules that extend the node form with form-level
  //   submit handlers that adjust $form_state['values'] prior to those values
  //   being used to update the entity. Module authors are encouraged to instead
  //   adjust the node directly within a hook_node_submit() implementation. For
  //   Backdrop 2.x, evaluate whether the pattern of triggering form-level
  //   submit handlers during button-level submit processing is worth supporting
  //   properly, and if so, add a Form API function for doing so.
  $node = $form_state['node'];

  // Convert the scheduled date into a timestamp.
  $form_state['values']['status'] = (int) $form_state['values']['status'];
  if ($form_state['values']['status'] === NODE_SCHEDULED) {
    if (is_array($form_state['values']['scheduled'])) {
      $form_state['values']['scheduled'] = $form_state['values']['scheduled']['date'] . ' ' . $form_state['values']['scheduled']['time'];
    $schedule_date = new BackdropDateTime($form_state['values']['scheduled']);
    $form_state['values']['scheduled'] = $schedule_date->format('U');
    $form_state['values']['status'] = NODE_NOT_PUBLISHED;
  // Or if not scheduled, set timestamp to 0, indicating it is not scheduled.
  else {
    $form_state['values']['scheduled'] = 0;

  form_execute_handlers('submit', $form, $form_state);
  entity_form_submit_build_entity('node', $node, $form, $form_state);
  foreach (module_implements('node_submit') as $module) {
    $function = $module . '_node_submit';
    $function($node, $form, $form_state);
  return $node;