You are here

function access_entity_info in Access Control Kit 7

Implements hook_entity_info().

File

./access.module, line 11
The access control kit module.

Code

function access_entity_info() {

  // Access grants.
  $types['access_grant'] = array(
    'label' => t('Access grant'),
    'controller class' => 'AccessGrantEntityController',
    'base table' => 'access_grant',
    'uri callback' => 'access_grant_uri',
    'label callback' => 'access_grant_label',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'gid',
      'bundle' => 'scheme',
    ),
    'bundle keys' => array(
      'bundle' => 'machine_name',
    ),
    'bundles' => array(),
    'view modes' => array(
      'full' => array(
        'label' => t('Access grant page'),
        'custom settings' => FALSE,
      ),
    ),
  );

  // Bundles are access schemes; the access realm field in the bundle determines
  // which objects are accessible to a user via an access grant.
  foreach (access_scheme_names() as $machine_name => $name) {
    $types['access_grant']['bundles'][$machine_name] = array(
      'label' => $name,
      'admin' => array(
        'path' => 'admin/structure/access/%access_scheme_machine_name',
        'real path' => 'admin/structure/access/' . str_replace('_', '-', $machine_name),
        'bundle argument' => 3,
        'access arguments' => array(
          'administer access schemes',
        ),
      ),
    );
  }

  // Access schemes.
  $types['access_scheme'] = array(
    'label' => t('Access scheme'),
    'controller class' => 'AccessSchemeEntityController',
    'base table' => 'access_scheme',
    'entity keys' => array(
      'id' => 'sid',
      'label' => 'name',
    ),
    'fieldable' => FALSE,
  );
  return $types;
}