You are here

function theme_og_subgroups_menu_tree_link in Subgroups for Organic groups 6

Theme callback to output a link for a group tree

Parameters

$current: The current group being view

$group: The group we're generating a link for

$access: Whether or not to check each link for adequate access, neaning if the group is private, and the user is not a member, mask the name and provide plain-text instead of a link. The same goes for unpublished group nodes. @see og_subgroups_mask_group_title()

4 theme calls to theme_og_subgroups_menu_tree_link()
og_subgroups_group_tree_json in includes/json.inc
Generate a group hierarchy tree in JSON format
theme_og_subgroups_menu_tree in includes/theme.inc
Theme a group hierachy tree
theme_og_subgroups_menu_tree_branch in includes/theme.inc
Theme a group hierachy tree branch
_og_subgroups_group_tree_branch_json in includes/json.inc
Recursive callback to return a tree branch in the format needed for JSON

File

includes/theme.inc, line 147

Code

function theme_og_subgroups_menu_tree_link($current, $group, $access = TRUE) {

  // Check access, if desired
  if ($access) {

    // Mask the group title, if needed
    if (og_subgroups_mask_group($group)) {

      // If it was masked, return just the title instead of a link
      return $group->title;
    }
  }

  // Generate the link
  $link = array(
    'title' => $group->title,
    'href' => "node/{$group->nid}",
    'options' => array(),
  );

  // See if this link is for the current group
  if ($current->nid == $group->nid) {

    // Add an active class
    $link['options']['attributes']['class'] = 'og-subgroups-tree-active';
  }
  return l($link['title'], $link['href'], $link['options']);
}