You are here

function domain_node_access_explain in Domain Access 7.3

Same name and namespace in other branches
  1. 5 domain.module \domain_node_access_explain()
  2. 6.2 domain.module \domain_node_access_explain()
  3. 7.2 domain.module \domain_node_access_explain()

Implements hook_node_access_explain().

File

./domain.module, line 3350
Core module functions for the Domain Access suite.

Code

function domain_node_access_explain($row) {
  $_domain = domain_get_domain();
  $active = $_domain['subdomain'];
  $domain = domain_lookup($row->gid);
  $return = t('Domain Access') . ' -- ';
  switch ($row->realm) {
    case 'domain_all':
      if (domain_grant_all() == TRUE) {
        $return .= t('True: Allows content from all domains to be shown.');
      }
      else {
        if (!empty($_domain['site_grant'])) {
          $return .= t('False: Only allows content from the active domain (%domain) or from all affiliates.', array(
            '%domain' => $active,
          ));
        }
        else {
          $return .= t('False: Only allows content from the active domain (%domain).', array(
            '%domain' => $active,
          ));
        }
      }
      break;
    case 'domain_site':
      $return .= t('Viewable on all affiliate sites.');
      break;
    case 'domain_id':
      $return .= t('Viewable on %domain<br />%domain privileged editors may edit and delete', array(
        '%domain' => $domain['subdomain'],
      ));
      break;
    case 'domain_unpublished':
      $return .= t('Unpublished node. Viewable on %domain<br />%domain privileged editors may edit and delete', array(
        '%domain' => $domain['subdomain'],
      ));
      break;
    default:

      // This is not our grant, do not return anything.
      $return = NULL;
      break;
  }
  return $return;
}