You are here

function ggroup_entity_property_info_alter in Group 7

Implements hook_entity_property_info_alter().

Informs Drupal of the changes we made to {group_membership}.

File

modules/ggroup/ggroup.entity.inc, line 20
Contains all Entity API functions for the Subgroup module.

Code

function ggroup_entity_property_info_alter(&$info) {
  $group_membership =& $info['group_membership']['properties'];
  $group_membership['parent_membership'] = array(
    'label' => t('Parent membership'),
    'description' => t('The membership from which this one was inherited.'),
    'type' => 'group_membership',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'parent_mid',
  );
  $group_membership['heritage'] = array(
    'label' => t('Membership heritage'),
    'description' => t('The inheritance metadata for the group membership.'),
    'type' => 'struct',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'heritage',
  );
  $group_role_list = array(
    'type' => 'list<group_role>',
    'options list' => 'group_role_labels',
    'setter callback' => 'entity_property_verbatim_set',
    'computed' => TRUE,
  );
  $group_membership['heritage']['property info']['initial'] = array(
    'label' => t('Inherited roles'),
    'description' => t('The group roles that were initially inherited.'),
  ) + $group_role_list;
  $group_membership['heritage']['property info']['granted'] = array(
    'label' => t('Granted roles'),
    'description' => t('The group roles that were granted on top of the inherited ones.'),
  ) + $group_role_list;
  $group_membership['heritage']['property info']['revoked'] = array(
    'label' => t('Inherited roles'),
    'description' => t('The group roles that were revoked from the inherited ones.'),
  ) + $group_role_list;
}