The Entity Operations module is a system to allow fast building of UIs for custom entity types, with very little code. It allows for basic operations such as 'view', 'edit', 'delete', while being extensible to allow any kind of custom operation.

For an entity which only needs to use a basic form, this means that only 3 functions are required to define the entity type: hook_schema() for its table, hook_entity_info(), and the entity access callback.

Furthermore, operations are exposed to a variety of other systems:

  • Operations are available as fields to Views, as links to the operation tab (for example, 'view', 'edit', 'delete' links on a list of entities).
  • Operations that behave as actions can be added to a view using Views Bulk Operations, to act on multiple entities at once.
  • Operations that behave as actions are exposed to Services as targeted actions on entities
  • Operations that provide forms can be shown as forms on the entity view page

Overview

Entity Operations provides a UI modelled on the way nodes work:

  • The various paths for working with nodes have a common base, 'node'
  • An individual node can be viewed at 'node/ID'
  • Further operations and tasks on the node can be viewed at paths such as 'node/ID/edit', 'node/ID/delete' and so on.

For your custom entity this works the same:

  • Define the common base path, eg, 'myentity'
  • Define operations on the entity, such as 'view', 'edit', 'delete'. These then form paths at 'myentity/ID/view', 'myentity/ID/edit' and so on
  • Define one operation to be the default, which is then output for 'myentity/ID'. This will usually be 'view'.