domain_form_submit

Versions
domain
domain_form_submit($form, &$form_state)

Implement domain_form submit hook.

Code

./domain.admin.inc, line 507

<?php
function domain_form_submit($form, &$form_state) {
  // Populate sql values used in both queries.
  $values = domain_values_from_form_state($form_state);

  // Update or create a new domain depending on presence of domain_id.
  if ($values['domain_id']) {
    $sql = "UPDATE {domain} SET subdomain = '%s', sitename = '%s', scheme = '%s', valid = %d WHERE domain_id = %d";
    $action = 'update';
    $message = t('Domain record updated.');
  }
  else {
    $sql = "INSERT INTO {domain} (subdomain, sitename, scheme, valid) VALUES ('%s', '%s', '%s', %d)";
    $action = 'create';
    $message = t('Domain record created.');
  }

  // Update the record.
  db_query($sql, $values);

  // Let other modules act.
  $domain = domain_lookup(NULL, $values['subdomain']);
  module_invoke_all('domainupdate', $action, $domain, $form_state);

  // Hide the message for the Domain User module.
  if (empty($form_state['values']['domain_arguments']['user_submitted'])) {
    drupal_set_message($message);
  }

  return $domain;
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List