You are here

function og_entity_property_info in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.module \og_entity_property_info()

Implements hook_entity_property_info().

  • Add group metadata for every fieldable entity that is a group type.
  • Add group-membership metadata for every fieldable entity that is a group content type.

File

./og.module, line 233
Enable users to create and manage groups with roles and permissions.

Code

function og_entity_property_info() {
  $info = array();
  foreach (og_get_all_group_content_entity() as $entity_type => $name) {
    $info[$entity_type]['properties']['og_membership'] = array(
      'label' => t("Group memberships"),
      'type' => 'list<og_membership>',
      'description' => t("A list of all group memberships of the @name entity.", array(
        '@name' => $name,
      )),
      'getter callback' => 'og_get_properties',
    );
  }
  foreach (og_get_all_group_entity() as $entity_type => $name) {
    $info[$entity_type]['properties']['group'] = array(
      'label' => t("Group"),
      'type' => 'group',
      'description' => t("The group associated with the @name entity.", array(
        '@name' => $name,
      )),
      'getter callback' => 'og_get_properties',
    );
  }
  return $info;
}