You are here

function hook_domainupdate in Domain Access 7.2

Same name and namespace in other branches
  1. 5 API.php \hook_domainupdate()
  2. 6.2 API.php \hook_domainupdate()

Notify other modules that we have created a new domain or updated a domain record.

For 'update' and 'delete' operations, the $domain array holds the original values of the domain record. The $edit array will hold the new, replacement values. This is useful when making changes to records, such as in domain_user_domainupdate().

Parameters

$op: The operation being performed: 'create', 'update', 'delete'

$domain: The domain record taken from {domain}, as an array.

$form_values: The form values processed by the form. Note that these are not editable since module_invoke_all() cannot pass by reference. We set $form_values to an array by default in case this hook gets called by a non-form function.

Related topics

6 functions implement hook_domainupdate()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

domain_alias_domainupdate in domain_alias/domain_alias.module
Implements hook_domainupdate().
domain_conf_domainupdate in domain_conf/domain_conf.module
Implements hook_domainupdate().
domain_domainupdate in ./domain.module
Implements hook_domainupdate()
domain_nav_domainupdate in domain_nav/domain_nav.module
Implements hook_domainupdate()
domain_source_domainupdate in domain_source/domain_source.module
Implements hook_domainupdate()

... See full list

4 invocations of hook_domainupdate()
domain_configure_form_submit in ./domain.admin.inc
Save any changes to the primary domain record.
domain_delete in ./domain.module
Delete a domain record.
domain_save in ./domain.module
Domain save function.
domain_set_primary_domain in ./domain.module
Set the primary domain properly, if necessary.

File

./domain.api.php, line 61
API documentation file.

Code

function hook_domainupdate($op, $domain, $form_values = array()) {
  switch ($op) {
    case 'create':
      db_insert('mytable')
        ->fields(array(
        'domain_id' => $domain['domain_id'],
        'myvar' => 1,
      ))
        ->execute();
      break;
    case 'update':
      db_update('mytable')
        ->fields(array(
        'status' => 1,
      ))
        ->condition('domain_id', $domain['domain_id'])
        ->execute();
      break;
    case 'delete':
      db_delete('mytable')
        ->condition('domain_id', $domain['domain_id'])
        ->execute();
      break;
  }
}