Data types
Last updated on
4 August 2017
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
These are the data types to be used for describing entity properties:
| Type | Usage |
|---|---|
| text | Any text. |
| token | A string containing only lowercase letters, numbers, and underscores; e.g. this type is useful for machine readable names. |
| integer | A usual PHP integer value. |
| decimal | A PHP float or integer. |
| date | A full date and time, as timestamp. |
| duration | A duration as number of seconds. |
| boolean | A usual PHP boolean value. |
| uri | An absolute URI or URL. |
| entities | You may use the type of each entity known by hook_entity_info(), e.g. 'node' or 'user'. Internally entities are represented by their identifiers. |
| entity | A special type to be used generically for entities where the entity type is not known beforehand. The entity has to be represented using an EntityMetadataWrapper. |
| struct | This as well as any else not known type may be used for supporting arbitrary data structures. For that additional metadata has to be specified with the 'property info' key. |
| list | A list of values, represented as numerically indexed array. The list<TYPE> notation may be used to specify the type of the contained items, where TYPE may be any valid type expression. E.g. use list<node> for a list of nodes. |
| unknown | Any data. This doesn't have any validation. |
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.