You are here

function og_context_get_properties in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og_context/og_context.module \og_context_get_properties()

Property getter callback.

Get the current group from context. For example get the group form context of entity type node.

$wrapper = entity_metadata_site_wrapper();
$group = $wrapper->og_context__node
  ->value();
1 string reference to 'og_context_get_properties'
og_context_entity_property_info in og_context/og_context.module
Implements hook_entity_property_info().

File

og_context/og_context.module, line 77
Get a group from a viewed page.

Code

function og_context_get_properties($data = array(), array $options, $name, $type) {

  // Get the entity type form the property name.
  $group_type = str_replace('og_context__', '', $name);
  if ($context = og_context($group_type)) {
    return entity_load_single($group_type, $context['gid']);
  }
}