You are here

function eloqua_webform_create in Eloqua 7

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

Creates webform settings from the database.

@hook eloqua_form_create

Parameters

object $webform: The webform.

Return value

bool The result of the update.

1 call to eloqua_webform_create()
eloqua_webform_configure_form_submit in eloqua_webform/eloqua_webform.module
Form submission handler for eloqua_webform_configure_form().

File

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

Code

function eloqua_webform_create($webform) {
  if (!is_object($webform)) {
    $type = gettype($webform);
    watchdog('eloqua', 'Invalid argument sent to !module_name (!type).', array(
      '!module_name' => __FUNCTION__,
      '!type' => $type,
    ));
    return FALSE;
  }
  $index = array(
    'nid' => $webform->{'nid'},
  );
  $fields = array(
    'form_name' => $webform->{'form_name'},
    'is_active' => $webform->{'is_active'},
    'data' => serialize($webform->{'data'}),
  );
  $result = _eloqua_db_insert_update($index, $fields);

  // If unable to create the payment plan, end.
  if (!$result) {
    return FALSE;
  }
  foreach (module_implements('eloqua_form_create') as $module_name) {
    $method = $module_name . '_eloqua_form_create';
    $method($webform);
  }
  _eloqua_webform_update($webform);
  return $result;
}