You are here

function domain_source_update_nodes in Domain Access 6.2

Same name and namespace in other branches
  1. 5 domain_source/domain_source.module \domain_source_update_nodes()
  2. 7.3 domain_source/domain_source.module \domain_source_update_nodes()
  3. 7.2 domain_source/domain_source.module \domain_source_update_nodes()

FormAPI function that lets us update access rules.

2 string references to 'domain_source_update_nodes'
domain_source_form_domain_content_form_alter in domain_source/domain_source.module
Form integration with Domain Content.
domain_source_form_node_admin_content_alter in domain_source/domain_source.module
Form integration with Administer nodes.

File

domain_source/domain_source.module, line 302
Creates a source domain for linking to content from other domains.

Code

function domain_source_update_nodes($form, &$form_state) {

  // If our operation is flagged, then we have to manually change the
  // {domain_source} table.  The rest of the process will clear the cache,
  // so this should be a safe operation.
  if ($form_state['values']['operation'] == 'domain') {
    $source = $form_state['values']['domain_source'];
    if ($source == DOMAIN_SOURCE_IGNORE) {
      return;
    }
    foreach ($form_state['values']['nodes'] as $key => $value) {
      if ($key == $value) {
        db_query("DELETE FROM {domain_source} WHERE nid = %d", $key);
        db_query("INSERT INTO {domain_source} (nid, domain_id) VALUES (%d, %d)", $key, $source);
      }
    }
  }
}