You are here

function party_entity_info in Party 7

Same name and namespace in other branches
  1. 8.2 party.module \party_entity_info()

Implements hook_entity_info().

Declare our party entity to the entity system.

File

./party.module, line 28
Provides a generic CRM party entity.

Code

function party_entity_info() {
  $party_info['party'] = array(
    'label' => t('Party'),
    'plural label' => t('Parties'),
    'entity class' => 'Party',
    'controller class' => 'PartyController',
    'merge handler class' => 'PartyMergeHandler',
    // We define this so entity module provides us with basic Views data, while
    // allowing us to define more of our own.
    // See http://drupal.org/node/1307760.
    'views controller class' => 'EntityDefaultViewsController',
    'base table' => 'party',
    //'uri callback' => 'party_uri',
    'fieldable' => TRUE,
    'module' => 'party',
    'entity keys' => array(
      'id' => 'pid',
      'label' => 'label',
    ),
    'access callback' => 'party_entity_access',
    'uri callback' => 'party_uri',
    // Entity API admin UI.
    'admin ui' => array(
      'controller class' => 'PartyUIController',
      'path' => 'admin/community',
      // Urgh. Our admin UI is split between admin.inc and pages.inc!
      // @todo untangle and fix.
      'file' => 'party.pages.inc',
    ),
    //'static cache' => TRUE,
    'bundles' => array(
      'party' => array(
        'label' => t('Party'),
        'admin' => array(
          'path' => 'admin/community/party',
          'access arguments' => array(
            'administer parties',
          ),
        ),
      ),
    ),
    'view modes' => array(
      'full' => array(
        'label' => t('Full Contact'),
        'custom settings' => FALSE,
      ),
    ),
    // We don't want redirects on party.
    'redirect' => FALSE,
  );
  return $party_info;
}