Same name and namespace in other branches
  1. 5.x developer/hooks/node.php \hook_submit()

This is a hook used by node modules. It is called after validation has succeeded and before insert/update. It is used to for actions which must happen only if the node is to be saved. Usually, $node is changed in some way and then the actual saving of that change is left for the insert/update hooks.

Parameters

&$node: The node being saved.

Return value

None.

For a detailed usage example, see fileupload.module.

Related topics

72 functions implement hook_submit()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_admin_remove_feed_submit in modules/aggregator.module
Remove all items from a feed and redirect to the overview page.
aggregator_form_category_submit in modules/aggregator.module
Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.
aggregator_form_feed_submit in modules/aggregator.module
Process aggregator_form_feed form submissions. @todo Add delete confirmation dialog.
aggregator_page_list_submit in modules/aggregator.module
archive_browse_form_submit in modules/archive.module
Process archive browse form submission.

... See full list

1 invocation of hook_submit()
user_edit_submit in modules/user.module

File

developer/hooks/node.php, line 126
These hooks are defined by node modules, modules that define a new kind of node.

Code

function hook_submit(&$node) {

  // if a file was uploaded, move it to the files directory
  if ($file = file_check_upload('file')) {
    $node->file = file_save_upload($file, file_directory_path(), false);
  }
}