You are here

function group_entity_info in Group 7

Implements hook_entity_info().

Defines the entities this module needs to function.

File

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

Code

function group_entity_info() {
  $info['group'] = array(
    'label' => t('Group'),
    'plural label' => t('Groups'),
    'description' => t('Groups people and content with roles and permissions.'),
    'entity class' => 'Group',
    'controller class' => 'GroupController',
    'base table' => 'groups',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'gid',
      'bundle' => 'type',
      'label' => 'title',
    ),
    'access callback' => 'group_entity_access',
    'label callback' => 'entity_class_label',
    'uri callback' => 'entity_class_uri',
    // Bundles are set in group_entity_info_alter().
    'bundles' => array(),
    'bundle keys' => array(
      'bundle' => 'name',
    ),
    'view modes' => array(
      'full' => array(
        'label' => t('Group page'),
        'custom settings' => FALSE,
      ),
    ),
    'module' => 'group',
    'admin ui' => array(
      'path' => 'admin/group',
      'file' => 'forms/group.inc',
      'controller class' => 'GroupUIController',
    ),
    'extra fields controller class' => 'GroupExtraFieldsController',
    'views controller class' => 'GroupViewsController',
    // Add Title module support.
    'field replacement' => array(
      'title' => array(
        'field' => array(
          'type' => 'text',
          'cardinality' => 1,
          'translatable' => TRUE,
        ),
        'instance' => array(
          'label' => t('Title'),
          'description' => t('The name of the group.'),
          'required' => TRUE,
          'settings' => array(
            'text_processing' => 0,
          ),
          'widget' => array(
            'weight' => -5,
          ),
          'display' => array(
            'default' => array(
              'type' => 'hidden',
            ),
          ),
        ),
      ),
    ),
  );
  $info['group_type'] = array(
    'label' => t('Group type'),
    'plural label' => t('Group types'),
    'description' => t('Define different group types.'),
    'entity class' => 'GroupType',
    'controller class' => 'GroupTypeController',
    'base table' => 'group_type',
    'fieldable' => FALSE,
    'bundle of' => 'group',
    'exportable' => TRUE,
    'entity keys' => array(
      'id' => 'tid',
      'name' => 'name',
      'label' => 'label',
    ),
    'access callback' => 'group_configure_access',
    'label callback' => 'entity_class_label',
    'module' => 'group',
    'admin ui' => array(
      'path' => 'admin/group/type',
      'file' => 'admin/group_type.inc',
      'controller class' => 'GroupTypeUIController',
    ),
    'features controller class' => 'GroupTypeFeaturesController',
    'views controller class' => 'EntityDefaultViewsController',
    // Add Internationalization module support.
    'i18n controller class' => 'EntityDefaultI18nStringController',
  );
  $info['group_role'] = array(
    'label' => t('Group role'),
    'plural label' => t('Group roles'),
    'description' => t('Define different group roles.'),
    'entity class' => 'GroupRole',
    'controller class' => 'GroupRoleController',
    'base table' => 'group_role',
    'fieldable' => FALSE,
    'exportable' => TRUE,
    'entity keys' => array(
      'id' => 'rid',
      'name' => 'name',
      'label' => 'label',
    ),
    'access callback' => 'group_configure_access',
    'label callback' => 'entity_class_label',
    'module' => 'group',
    'admin ui' => array(
      'path' => 'admin/group/role',
      'file' => 'admin/group_role.inc',
      'controller class' => 'GroupRoleUIController',
    ),
    'features controller class' => 'GroupRoleFeaturesController',
    'views controller class' => 'EntityDefaultViewsController',
    // Add Internationalization module support.
    'i18n controller class' => 'EntityDefaultI18nStringController',
  );
  $info['group_membership'] = array(
    'label' => t('Group membership'),
    'plural label' => t('Group memberships'),
    'description' => t('Provides functionality to link Group to User entities.'),
    'entity class' => 'GroupMembership',
    'controller class' => 'GroupMembershipController',
    'base table' => 'group_membership',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'mid',
    ),
    'access callback' => 'group_membership_access',
    'label callback' => 'entity_class_label',
    'uri callback' => 'entity_class_uri',
    'bundles' => array(
      'group_membership' => array(
        'label' => t('Group member'),
        'admin' => array(
          'path' => 'admin/group/member/manage/group_membership',
          'access arguments' => array(
            'configure group module',
          ),
        ),
      ),
    ),
    'view modes' => array(
      'full' => array(
        'label' => t('Member page'),
        'custom settings' => FALSE,
      ),
    ),
    'module' => 'group',
    'admin ui' => array(
      'path' => 'admin/group/member',
      'controller class' => 'GroupMembershipUIController',
    ),
    'extra fields controller class' => 'GroupMembershipExtraFieldsController',
    'views controller class' => 'GroupMembershipViewsController',
  );
  return $info;
}