hook_submit

Versions
4.7 – 5
hook_submit(&$node)

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.

For a detailed usage example, see fileupload.module.

Parameters

&$node The node being saved.

Return value

None.

Related topics

Code

developer/hooks/node.php, line 191

<?php
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);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.