You are here

function relation_entity_info in Relation 7

Implements hook_entity_info().

1 call to relation_entity_info()
relation_ui_type_list in ./relation_ui.module
List all relation_types (page callback).

File

./relation.module, line 14
Describes relations between entities.

Code

function relation_entity_info() {
  $entities['relation'] = array(
    'label' => t('Relation'),
    'label callback' => 'relation_label',
    'base table' => 'relation',
    'revision table' => 'relation_revision',
    'fieldable' => TRUE,
    'controller class' => 'RelationController',
    'save callback' => 'relation_save',
    'creation callback' => 'relation_entity_create',
    'deletion callback' => 'relation_delete',
    'access callback' => 'relation_rules_access',
    'uri callback' => 'relation_uri',
    'view callback' => 'relation_multiple_view',
    'entity keys' => array(
      'id' => 'rid',
      'revision' => 'vid',
      'bundle' => 'relation_type',
      'label' => 'rid',
    ),
    'bundle keys' => array(
      'bundle' => 'relation_type',
    ),
    'bundles' => array(),
    'view modes' => array(),
  );
  foreach (relation_get_types() as $type => $info) {
    $entities['relation']['bundles'][$type] = (array) $info;
    $entities['relation']['bundles'][$type]['admin'] = array(
      'path' => 'admin/structure/relation/manage/%relation_type',
      'real path' => 'admin/structure/relation/manage/' . $type,
      'bundle argument' => 4,
      'access arguments' => array(
        'administer relation types',
      ),
    );
  }
  return $entities;
}