You are here

function entity_metadata_hook_entity_info in Entity API 7

Provide additional metadata for entities.

This is a placeholder for describing further keys for hook_entity_info(), which are introduced the entity API in order to support any entity type; e.g. to make entity_save(), entity_create(), entity_view() and others work. See entity_crud_hook_entity_info() for the documentation of additional keys for hook_entity_info() as introduced by the entity API for providing new entity types with the entity CRUD API.

Additional keys are:

  • plural label: (optional) The human-readable, plural name of the entity type. As 'label' it should start capitalized.
  • description: (optional) A human-readable description of the entity type.
  • access callback: (optional) Specify a callback that returns access permissions for the operations 'create', 'update', 'delete' and 'view'. The callback gets optionally the entity and the user account to check for passed. See entity_access() for more details on the arguments and entity_metadata_no_hook_node_access() for an example.
  • creation callback: (optional) A callback that creates a new instance of this entity type. See entity_metadata_create_node() for an example.
  • save callback: (optional) A callback that permanently saves an entity of this type.
  • deletion callback: (optional) A callback that permanently deletes an entity of this type.
  • revision deletion callback: (optional) A callback that deletes a revision of the entity.
  • view callback: (optional) A callback to render a list of entities. See entity_metadata_view_node() as example.
  • form callback: (optional) A callback that returns a fully built edit form for the entity type.
  • token type: (optional) A type name to use for token replacements. Set it to FALSE if there aren't any token replacements for this entity type.
  • configuration: (optional) A boolean value that specifies whether the entity type should be considered as configuration. Modules working with entities may use this value to decide whether they should deal with a certain entity type. Defaults to TRUE to for entity types that are exportable, else to FALSE.

See also

hook_entity_info()

entity_crud_hook_entity_info()

entity_access()

entity_create()

entity_save()

entity_delete()

entity_view()

entity_form()

File

./entity.api.php, line 240
Hooks provided by the entity API.

Code

function entity_metadata_hook_entity_info() {
  return array(
    'node' => array(
      'label' => t('Node'),
      'access callback' => 'entity_metadata_no_hook_node_access',
    ),
  );
}