You are here

function domain_content_menu in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_content/domain_content.module \domain_content_menu()
  2. 7.3 domain_content/domain_content.module \domain_content_menu()
  3. 7.2 domain_content/domain_content.module \domain_content_menu()

Implement hook_menu()

File

domain_content/domain_content.module, line 23
Editorial overview module.

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/' . $domain['domain_id'],
        '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;
}