You are here

function domain_prefix_domainupdate in Domain Access 6.2

Same name and namespace in other branches
  1. 5 domain_prefix/domain_prefix.module \domain_prefix_domainupdate()

Implement hook_domainupdate().

File

domain_prefix/domain_prefix.module, line 205
Interface for selective table prefixing for use with Domain Access.

Code

function domain_prefix_domainupdate($op, $domain, $form_state = array()) {

  // Include the extra functions.
  module_load_include('inc', 'domain_prefix', 'domain_prefix.admin');
  switch ($op) {
    case 'create':
      $rule = variable_get('domain_prefix_options', 1);
      if ($rule) {

        // Get the current settings.
        $settings = variable_get('domain_prefix', NULL);
        if (!empty($settings)) {
          $settings['domain_id'] = $domain['domain_id'];
          $form_state['values']['op'] = t('Generate domain tables');
          $form_state['values']['execute'] = TRUE;
          drupal_execute('domain_prefix_form', $form_state, $domain, $settings);
        }
      }
      break;
    case 'delete':
      domain_prefix_drop_records($domain['domain_id']);
      break;
  }
}