You are here

function og_CrumbsMultiPlugin_group_post::findParent__node_x in Crumbs, the Breadcrumbs suite 7

Same name in this branch
  1. 7 plugins/crumbs.og.inc \og_CrumbsMultiPlugin_group_post::findParent__node_x()
  2. 7 plugins/crumbs.og.2.inc \og_CrumbsMultiPlugin_group_post::findParent__node_x()
Same name and namespace in other branches
  1. 7.2 plugins/crumbs.og.inc \og_CrumbsMultiPlugin_group_post::findParent__node_x()
  2. 7.2 plugins/crumbs.og.2.inc \og_CrumbsMultiPlugin_group_post::findParent__node_x()

File

plugins/crumbs.og.inc, line 35

Class

og_CrumbsMultiPlugin_group_post
Use the group node as a parent for group posts. The priorities can be configured per group content type.

Code

function findParent__node_x($path, $item) {
  $node = $item['map'][1];

  // Load the node if it hasn't been loaded due to a missing wildcard loader.
  $node = is_numeric($node) ? node_load($node) : $node;
  $items = field_get_items('node', $node, 'group_audience');
  if ($items) {
    foreach ($items as $item) {
      $row = db_query("SELECT * FROM {og} WHERE gid = :gid", array(
        ':gid' => $item['gid'],
      ))
        ->fetchObject();
      if ($row && $row->entity_type === 'node') {
        $parent_path = $this
          ->getParentPath($row->etid, $node);
        return array(
          $node->type => $parent_path,
        );
      }
    }
  }
}