You are here

function hook_webform_draft_alter in Webform 7.4

Modify the draft to be presented for editing.

When drafts are enabled for the webform, by default, a pre-existing draft is presented when the webform is displayed to that user. To allow multiple drafts, implement this alter function to set the $sid to NULL, or use your application's business logic to determine whether a new draft or which of the pre-existing drafts should be presented.

Parameters

int $sid: The id of the most recent submission to be presented for editing. Change to a different draft's sid or set to NULL for a new draft.

array $context: Array of context with indices 'nid' and 'uid'.

Related topics

1 invocation of hook_webform_draft_alter()
_webform_fetch_draft_sid in ./webform.module
Check if current user has a draft of this webform, and return the sid.

File

./webform.api.php, line 249
Sample hooks demonstrating usage in Webform.

Code

function hook_webform_draft_alter(&$sid, array $context) {
  if ($_GET['newdraft']) {
    $sid = NULL;
  }
}