You are here

function domain_source_update_nodes in Domain Access 7.2

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

FormAPI function that lets us update access rules.

1 string reference to 'domain_source_update_nodes'
domain_source_form_domain_content_admin_alter in domain_source/domain_source.module
Integrate with Domain Content.

File

domain_source/domain_source.module, line 360
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
  // {node_access} 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'];
    foreach ($form_state['values']['nodes'] as $key => $value) {
      if ($key == $value) {
        db_delete('domain_source')
          ->condition('nid', $key)
          ->execute();
        db_insert('domain_source')
          ->fields(array(
          'nid' => $key,
          'domain_id' => $source,
        ))
          ->execute();
      }
    }
  }
}