You are here

class og_CrumbsMultiPlugin_my_groups_overview in Crumbs, the Breadcrumbs suite 7.2

Same name in this branch
  1. 7.2 plugins/crumbs.og.inc \og_CrumbsMultiPlugin_my_groups_overview
  2. 7.2 plugins/crumbs.og.2.inc \og_CrumbsMultiPlugin_my_groups_overview
Same name and namespace in other branches
  1. 7 plugins/crumbs.og.inc \og_CrumbsMultiPlugin_my_groups_overview
  2. 7 plugins/crumbs.og.2.inc \og_CrumbsMultiPlugin_my_groups_overview

Make $my_groups_path the parent path for group nodes where the current user is a member. The priorities can be configured per group node type.

Hierarchy

Expanded class hierarchy of og_CrumbsMultiPlugin_my_groups_overview

File

plugins/crumbs.og.inc, line 162

View source
class og_CrumbsMultiPlugin_my_groups_overview implements crumbs_MultiPlugin {

  /**
   * @var string
   */
  protected $myGroupsPath;

  /**
   * @param string $my_groups_path
   *   The path to be used as parent for all group nodes where the current user
   *   is a member.
   */
  function __construct($my_groups_path) {
    $this->myGroupsPath = $my_groups_path;
  }

  /**
   * {@inheritdoc}
   */
  function describe($api) {
    $types = node_type_get_types();
    foreach ($types as $type) {
      if (og_is_group_type('node', $type->type)) {
        $api
          ->addRule($type->type);
      }
    }
  }

  /**
   * @param string $path
   *   The path that we want to find a parent for.
   * @param array $item
   *   Loaded router item, as returned from crumbs_get_router_item()
   *
   * @return array
   *   Parent path candidates
   */
  function findParent__node_x($path, $item) {
    if (FALSE === ($node = crumbs_Util::itemExtractEntity($item, 'node', 1))) {
      return NULL;
    }
    if (og_is_group_type('node', $node->type)) {
      $group = og_get_group('node', $node->nid);
      if (!empty($group)) {
        if (og_is_member($group->gid)) {
          return array(
            $node->type => 'user-groups',
          );
        }
      }
    }
    return NULL;
  }

}

Members