domain_content_menu

Definition

domain_content_menu($may_cache)
domain_content/domain_content.module, line 23

Description

Implements hook_menu()

Code

function domain_content_menu($may_cache) {
  $items = array();
  $access = FALSE;
  $all = FALSE;
  $extra = '';
  if (user_access('edit domain nodes') && variable_get('domain_editors', DOMAIN_EDITOR_RULE)) { // || user_access('set domain access')
    $access = TRUE;
    $extra = '<p><em>'. t('You may not have editing permissions for all content shown on all affiliate sites.') .'</em></p>';
  }
  if (user_access('administer nodes')) { //  || user_access('set domain access')
    $access = TRUE;
    $all = TRUE;
    $extra = '';
  }
  if ($may_cache) {
    $items[] = array(
      'title' => t('Affiliated content'),
      'path' => 'admin/domain/content',
      'callback' => 'domain_content_page',
      'type' => MENU_NORMAL_ITEM,
      'access' => $access
    );
    $items[] = array(
      'title' => t('Content for all affiliate sites'),
      'path' => 'admin/domain/content/all',
      'callback' => 'domain_content_view',
      'description' => t('View content assigned to all affiliate sites.') . $extra,
      'callback arguments' => array(NULL, TRUE),
      'access' => $access,
      'weight' => -10
    );
    // Generate the list of active domains as menu items
    $domains = domain_domains();
    foreach ($domains as $domain) {
      $check = domain_content_check($domain, $all);
      $items[] = array(
        'path' => 'admin/domain/content/'. filter_xss_admin($domain['subdomain']),
        'title' => t('@domain content', array('@domain' => $domain['sitename'])),
        'description' => t('View content assigned to !domain', array('!domain' => $domain['subdomain'])),
        'callback' => 'domain_content_view',
        'callback arguments' => array($domain['domain_id'], FALSE),
        'access' => $check,
        'weight' => $domain['domain_id']
      );
    }
  }
  return $items;
}