Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Declares information about one or more field types.
Return value
An array keyed by field type name. Each element of the array is an associative array with these keys and values:
- 'label' : The human-readable label for the field type.
- 'description': A description of the field type.
Most modules declare a single field, but they can create any number of different types. Note that this module is declaring two types of fields, an integer and a decimal field.
/**
* Declare information about a field type.
*
* @return
* An array keyed by field type name. Each element of the array is an associative
* array with these keys and values:
* - "label": The human-readable label for the field type.
* - "description": A description of the field type.
*/
function hook_field_info() {
return array(
'number_integer' => array(
'label' => t('Integer'),
'description' => t('A field for integers (non-decimals)'),
),
'number_decimal' => array(
'label' => t('Decimal'),
'description' => t('A field for numbers with decimals'),
),
);
}