function og_context_get_properties

7.x-2.x og_context.module og_context_get_properties($data = array(), array $options, $name, $type)
7.x-1.x og_context.module og_context_get_properties($data = array(), array $options, $name, $type)

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'

File

og/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']);
  }
}