You are here

function group_entity_property_info in Group 7

Implements hook_entity_property_info().

File

./group.entity.inc, line 285
Contains all Entity API functions for the Group module.

Code

function group_entity_property_info() {
  $info = array();

  // Properties for Group entities.
  $group =& $info['group']['properties'];
  $group['gid'] = array(
    'label' => t('Group ID'),
    'description' => t('The unique group ID.'),
    'type' => 'integer',
    'validate callback' => ' entity_metadata_validate_integer_positive',
    'schema field' => 'gid',
  );
  $group['group_type'] = array(
    'label' => t('Group type'),
    'description' => t('The bundle of the group.'),
    'type' => 'group_type',
    'options list' => 'group_type_labels',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'type',
  );
  $group['title'] = array(
    'label' => t('Title'),
    'description' => t('The title of the group.'),
    'type' => 'text',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'title',
  );
  $group['url'] = array(
    'label' => t('URL'),
    'description' => t('The URL of the group.'),
    'type' => 'uri',
    'getter callback' => 'entity_metadata_entity_get_properties',
    'computed' => TRUE,
    'entity views field' => TRUE,
  );

  // Properties for GroupType entities.
  $group_type =& $info['group_type']['properties'];
  $group_type['tid'] = array(
    'label' => t('Group type ID'),
    'description' => t('The unique group type ID.'),
    'type' => 'integer',
    'validate callback' => ' entity_metadata_validate_integer_positive',
    'schema field' => 'tid',
  );
  $group_type['name'] = array(
    'label' => t('Machine name'),
    'description' => t('The machine readable name for the type.'),
    'type' => 'token',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'name',
  );
  $group_type['label'] = array(
    'label' => t('Label'),
    'description' => t('The human readable name for the type.'),
    'type' => 'text',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'label',
    // Add Internationalization module support.
    'translatable' => TRUE,
    'i18n string' => TRUE,
  );
  $group_type['anonymous_permissions'] = array(
    'label' => t('Anonymous permissions'),
    'description' => t('The anonymous permissions for the group type.'),
    'type' => 'list<text>',
    'options list' => 'group_permissions',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'anonymous_permissions',
  );
  $group_type['outsider_permissions'] = array(
    'label' => t('Outsider permissions'),
    'description' => t('The outsider permissions for the group type.'),
    'type' => 'list<text>',
    'options list' => 'group_permissions',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'outsider_permissions',
  );
  $group_type['member_permissions'] = array(
    'label' => t('Member permissions'),
    'description' => t('The member permissions for the group type.'),
    'type' => 'list<text>',
    'options list' => 'group_permissions',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'member_permissions',
  );
  $group_type['config'] = array(
    'label' => t('Group type configuration'),
    'description' => t('The specific configuration for the group type.'),
    'type' => 'struct',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'config',
  );
  $group_type['config']['property info']['creator_roles'] = array(
    'label' => t('Creator roles'),
    'description' => t('The group roles a user gets when creating a group.'),
    'type' => 'list<group_role>',
    'options list' => 'group_role_labels',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $group_type['weight'] = array(
    'label' => t('Weight'),
    'description' => t('The weight of the type compared to others.'),
    'type' => 'integer',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'weight',
  );
  $group_type['status'] = array(
    'label' => t('Entity status'),
    'description' => t('The entity status of the type.'),
    'type' => 'integer',
    'schema field' => 'status',
  );
  $group_type['module'] = array(
    'label' => t('Providing module'),
    'description' => t('The module providing the entity.'),
    'type' => 'text',
    'schema field' => 'module',
  );

  // Properties for GroupRole entities.
  $group_role =& $info['group_role']['properties'];
  $group_role['rid'] = array(
    'label' => t('Group role ID'),
    'description' => t('The unique group role ID.'),
    'type' => 'integer',
    'validate callback' => ' entity_metadata_validate_integer_positive',
    'schema field' => 'rid',
  );
  $group_role['group_type'] = array(
    'label' => t('Group type'),
    'description' => t('The group type the role is coupled to.'),
    'type' => 'group_type',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'type',
  );
  $group_role['name'] = array(
    'label' => t('Machine name'),
    'description' => t('The machine readable name for the role.'),
    'type' => 'token',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'name',
  );
  $group_role['label'] = array(
    'label' => t('Label'),
    'description' => t('The human readable name for the role.'),
    'type' => 'text',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'label',
    // Add Internationalization module support.
    'translatable' => TRUE,
    'i18n string' => TRUE,
  );
  $group_role['global'] = array(
    'label' => t('Global status'),
    'description' => t('Whether the role is global or not.'),
    'type' => 'boolean',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'global',
  );
  $group_role['permissions'] = array(
    'label' => t('Permissions'),
    'description' => t('The permissions for the role.'),
    'type' => 'list<text>',
    'options list' => 'group_permissions',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'permissions',
  );
  $group_role['weight'] = array(
    'label' => t('Weight'),
    'description' => t('The weight of the role compared to others.'),
    'type' => 'integer',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'weight',
  );
  $group_role['status'] = array(
    'label' => t('Entity status'),
    'description' => t('The entity status of the role.'),
    'type' => 'integer',
    'schema field' => 'status',
  );
  $group_role['module'] = array(
    'label' => t('Providing module'),
    'description' => t('The module providing the entity.'),
    'type' => 'text',
    'schema field' => 'module',
  );

  // Properties for GroupMembership entities.
  $group_membership =& $info['group_membership']['properties'];
  $group_membership['mid'] = array(
    'label' => t('Group membership ID'),
    'description' => t('The unique group membership ID.'),
    'type' => 'integer',
    'validate callback' => ' entity_metadata_validate_integer_positive',
    'schema field' => 'mid',
  );
  $group_membership['group'] = array(
    'label' => t('Group'),
    'description' => t('The group the membership belongs to.'),
    'type' => 'group',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'gid',
  );
  $group_membership['user'] = array(
    'label' => t('User'),
    'description' => t('The user the membership belongs to.'),
    'type' => 'user',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'uid',
  );

  // Generated in GroupMembershipController::load().
  $group_membership['roles'] = array(
    'label' => t('Roles'),
    'description' => t('The group roles for the membership.'),
    'type' => 'list<group_role>',
    'options list' => 'group_role_labels',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $group_membership['status'] = array(
    'label' => t('Membership status'),
    'description' => t('The membership status.'),
    'type' => 'token',
    'options list' => 'group_membership_status_types',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'status',
  );
  $group_membership['blocked_status'] = array(
    'label' => t('Membership status (blocked)'),
    'description' => t('The membership status before the member was blocked.'),
    'type' => 'token',
    'options list' => 'group_membership_status_types',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'blocked_status',
  );
  $group_membership['blocked_on'] = array(
    'label' => t('Blocked on'),
    'description' => t('The date when the member was blocked.'),
    'type' => 'date',
    'getter callback' => 'entity_property_verbatim_date_get',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'blocked_on',
  );
  $group_membership['blocked_by'] = array(
    'label' => t('Blocked by'),
    'description' => t('The user who blocked the member.'),
    'type' => 'user',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'blocked_by',
  );
  $group_membership['joined_on'] = array(
    'label' => t('Joined on'),
    'description' => t('The date when the member joined.'),
    'type' => 'date',
    'getter callback' => 'entity_property_verbatim_date_get',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'joined_on',
  );
  $group_membership['requested_on'] = array(
    'label' => t('Requested on'),
    'description' => t('The date when the member requested to join.'),
    'type' => 'date',
    'getter callback' => 'entity_property_verbatim_date_get',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'requested_on',
  );
  $group_membership['approved_on'] = array(
    'label' => t('Approved on'),
    'description' => t('The date when the member was approved.'),
    'type' => 'date',
    'getter callback' => 'entity_property_verbatim_date_get',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'approved_on',
  );
  $group_membership['approved_by'] = array(
    'label' => t('Approved by'),
    'description' => t('The user who approved the member.'),
    'type' => 'user',
    'setter callback' => 'entity_property_verbatim_set',
    'schema field' => 'approved_by',
  );
  return $info;
}