You are here

function webform_ensure_record in Webform 7.3

Same name and namespace in other branches
  1. 6.3 webform.module \webform_ensure_record()
  2. 7.4 webform.module \webform_ensure_record()

Utility function to ensure that a webform record exists in the database.

Parameters

$node: The node object to check if a database entry exists.

Return value

This function should always return TRUE if no errors were encountered, ensuring that a webform table row has been created. Will return FALSE if a record does not exist and a new one could not be created.

2 calls to webform_ensure_record()
webform_component_edit_form_submit in includes/webform.components.inc
Submit handler for webform_component_edit_form().
webform_email_edit_form_submit in includes/webform.emails.inc
Submit handler for webform_email_edit_form().

File

./webform.module, line 3162
This module provides a simple way to create forms and questionnaires.

Code

function webform_ensure_record(&$node) {
  if (!$node->webform['record_exists']) {

    // Even though webform_node_insert() would set this property to TRUE,
    // we set record_exists to trigger a difference from the defaults.
    $node->webform['record_exists'] = TRUE;
    webform_node_insert($node);
  }
  return $node->webform['record_exists'];
}