You are here

function domain_content_view in Domain Access 7.2

Same name and namespace in other branches
  1. 5 domain_content/domain_content.module \domain_content_view()
  2. 6.2 domain_content/domain_content.admin.inc \domain_content_view()
  3. 7.3 domain_content/domain_content.admin.inc \domain_content_view()

Content administration for a specific domain. This callback puts the user on the current domain and then fetches the appropirate content for batch editing.

Parameters

$domain_id: The unique identifier for the currently active domain.

$all_affiliates: A boolean flag that indicates whether to grant the domain_site node access realm for this content view.

Return value

A link group for each domain the user can access.

1 string reference to 'domain_content_view'
domain_content_menu in domain_content/domain_content.module
Implements hook_menu()

File

domain_content/domain_content.admin.inc, line 143
Administration pages for Domain Content.

Code

function domain_content_view($domain_id = NULL, $all_affiliates = FALSE) {
  $build = array();
  $_domain = domain_get_domain();

  // Load the active domain, which is not necessarily the current domain.
  if (!is_null($domain_id) && $domain_id != $_domain['domain_id']) {
    domain_set_domain($domain_id);
    $_domain = domain_get_domain();
  }
  $output = '';

  // Override the $_domain global so we can see the appropriate content
  if (!is_null($domain_id)) {
    $_domain['site_grant'] = FALSE;
    drupal_set_title(t('Content for @domain', array(
      '@domain' => $_domain['sitename'],
    )));
  }
  elseif ($all_affiliates) {
    $_domain['site_grant'] = TRUE;
    drupal_set_title(t('Content for all affiliate sites'));
  }
  else {
    drupal_set_message(t('Invalid request'), 'error');
    $build['content'] = array(
      '#markup' => t('<p>The specified domain does not exist.</p>'),
    );
    return $build;
  }
  $output = drupal_get_form('domain_content_admin');

  // Reset the active domain.
  domain_reset_domain();
  return $output;
}