You are here

function noderelationships_backref_build_content in Node Relationships 6

Build back reference content for the given node and region settings.

Parameters

$referred_node:

$region_settings:

2 calls to noderelationships_backref_build_content()
noderelationships_backref_page in ./noderelationships.pages.inc
Menu callback; Display back reference views in the node relationships tab.
_noderelationships_nodeapi_view in ./noderelationships.pages.inc
Implementation of hook_nodeapi('view').

File

./noderelationships.pages.inc, line 60
Implementation of user land pages.

Code

function noderelationships_backref_build_content($referred_node, &$region_settings) {
  $content = array();
  $referred_type = noderelationships_get_localized_content_type($referred_node->type);
  foreach ($region_settings as $relation_key => $relation_info) {
    list($type_name, $field_name) = explode(':', $relation_key);
    $referrer_type = noderelationships_get_localized_content_type($type_name);
    $context = array(
      'region_settings' => $region_settings,
      'referred_node' => $referred_node,
      'referred_type' => $referred_type,
      'referrer_type' => $referrer_type,
      'field_name' => $field_name,
    );
    $output = noderelationships_backref_render_view($relation_info['back_reference_view'], $context);
    if (!empty($output)) {
      $content['backref_' . $type_name . '_' . $field_name] = array(
        '#value' => $output,
        '#weight' => $relation_info['weight'],
      );
    }
  }

  // Allow external modules alter back references content.
  $context = array(
    'region_settings' => $region_settings,
    'referred_node' => $referred_node,
    'referred_type' => $referred_type,
  );
  drupal_alter('noderelationships_backref_content', $content, $context);
  return $content;
}