diff --git a/webform_nosave.info b/webform_nosave.info index 7779d15..4daad6e 100644 --- a/webform_nosave.info +++ b/webform_nosave.info @@ -1,6 +1,5 @@ name = Webform NoSave description = Disable the storage of Webforms in database core = 7.x -version = 7.x-3.x-dev package = Webform dependencies[] = webform diff --git a/webform_nosave.install b/webform_nosave.install index d5237f7..00023af 100644 --- a/webform_nosave.install +++ b/webform_nosave.install @@ -1,14 +1,29 @@ t('Webform NoSave data'), + 'description' => 'Webform NoSave data', 'fields' => array( - 'nid' => array('description' => t('The node id'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), - 'attachments' => array('description' => t('Delete attachments'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), + 'nid' => array( + 'description' => 'The node id', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE), + 'attachments' => array( + 'description' => 'Delete attachments', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0), ), 'primary key' => array('nid'), ); @@ -16,6 +31,7 @@ function webform_nosave_schema() { return $schema; } + /** * Add attachment field to Webform NoSave. */ diff --git a/webform_nosave.module b/webform_nosave.module index 5115d86..82ee9f1 100644 --- a/webform_nosave.module +++ b/webform_nosave.module @@ -2,16 +2,24 @@ /** * @file - * Disable the storage of Webforms in database + * Disable the storage of Webforms in database * * @author Sven Culley */ /** - * Load nosave object + * Load nosave object. + * + * @param int $nid + * The node id of the webform for which a nosave record should be loaded. + * + * @return mixed + * The webform record, or FALSE if one does not exist. */ function webform_nosave_load($nid) { - return db_query("SELECT * FROM {webform_nosave} WHERE nid = :nid", array(':nid' => $nid))->fetchObject(); + $record = db_query("SELECT * FROM {webform_nosave} WHERE nid = :nid", array(':nid' => $nid))->fetchObject(); + + return $record; } /** @@ -34,7 +42,9 @@ function webform_nosave_module_implements_alter(&$implementations, $hook) { * Implements hook_node_delete(). */ function webform_nosave_node_delete($node) { - db_delete('webform_nosave')->condition('nid', $node->nid)->execute(); + db_delete('webform_nosave') + ->condition('nid', $node->nid) + ->execute(); } /**