You are here

function eloqua_webform_load in Eloqua 7

Same name and namespace in other branches
  1. 6 eloqua.inc \eloqua_webform_load()
  2. 7.2 eloqua_webform/eloqua_webform.inc \eloqua_webform_load()

Loads webform settings from the database.

Parameters

int $nid: The webform node ID.

Return value

object The webform.

2 calls to eloqua_webform_load()
eloqua_webform_configure_form in eloqua_webform/eloqua_webform.module
Eloqua webform configure form.
eloqua_webform_form_alter in eloqua_webform/eloqua_webform.module
Implements hook_form_alter().

File

eloqua_webform/eloqua_webform.inc, line 25
Eloqua Helper functions and constants

Code

function eloqua_webform_load($nid) {

  // Get the raw result from the DB.
  if (!is_numeric($nid)) {
    $type = gettype($nid);
    watchdog('eloqua', 'Invalid argument sent to !module_name (!type).', array(
      '!module_name' => __FUNCTION__,
      '!type' => $type,
    ), WATCHDOG_DEBUG);
    return NULL;
  }

  // Load webform.
  $result = db_select('eloqua_webform')
    ->fields('eloqua_webform')
    ->condition('nid', $nid)
    ->execute()
    ->fetchAll(PDO::FETCH_OBJ);
  $result = _eloqua_unserialize_data_column($result);
  $webform = array_shift($result);
  if (empty($webform)) {
    return NULL;
  }

  // Send the object around to all of its friends.
  foreach (module_implements('eloqua_form_load') as $module_name) {
    $method = $module_name . '_eloqua_form_load';
    $method($webform);
  }
  return $webform;
}