Node State Save

Component ID

1844110

Component name

Node State Save

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

The idea behind this module is to allow the user to save the state of a node that has been partially filled out without actually saving the node yet.

This would be helpful on large node create / save forms that the user may not have the time or the knowledge to complete at that time.

The module does the following:

1) Creates a "pre-save" button via hook_form_alter on the node save form

When this is clicked, the current node fields that are filled out are serialized and inserted into a table (created at module install) for that user along with the current time() and the node_type being created and (in the case that the user is editing an existing node, the nid).

When the node edit page is loaded again by that user, hook_form_alter checks if there are any previous states for that node. It checks the timestamp when it was saved. If there is a pre-saved state, it pre-fills in those values by unserializing the node field objects for each field as it loops through all fields.

It also sets a notice via drupal_set_message() stating that values are being restored from a previous save (with that date output).

2) If there is a previous state for the node being edited or created, the module creates a "Reset State" button via hook_form_alter on the node_save form

When this is clicked, any temporary values for that node and user are cleared and the node edit page is reloaded.

Notes:

-A permission is necessary to use this functionality, so make sure your user has the proper permissions (see README).

-We do not validate fields when we save the state. So you could potentially pre-save a node state with values that will not actually submit without validation errors.

Ideas for the future:

1) Allow an admin to turn this functionality on for only certain node types.

2) Give a user the ability / permission to load states from other users.