function field_hidden_field_info in Field Hidden 7
Declares field types and their settings.
Types, and their database data types, widgets and default/optional formatters (aka display types):
- field_hidden_text: varchar field_hidden hidden/field_hidden_text_plain
- field_hidden_text_long: text field_hidden hidden/field_hidden_text_plain
- field_hidden_integer: integer field_hidden hidden/field_hidden_integer
- field_hidden_decimal: decimal field_hidden hidden/field_hidden_decimal
- field_hidden_float: float field_hidden hidden/field_hidden_decimal
Field settings apply to all instances of a field - e.g. if field 'some_hidden' of type field_hidden_integer is being used by more than one content type, field settings apply to 'some_hidden' across all content types.
Instance settings only apply to a single instance - e.g. to 'some_hidden' in the current content type - and instance settings may override field settings.
Implements hook_field_info().
Return value
array
File
- ./
field_hidden.module, line 84 - Drupal Field Hidden module
Code
function field_hidden_field_info() {
return array(
// text
'field_hidden_text' => array(
'label' => t('Hidden text'),
'description' => t('This field stores varchar text in the database.'),
'settings' => array(
'max_length' => 255,
),
'instance_settings' => array(
'text_processing' => 0,
),
'default_widget' => 'field_hidden',
'default_formatter' => 'hidden',
// alternative: field_hidden_text_plain
'default_token_formatter' => 'field_hidden_text_plain',
// Tokens integration.
'property_type' => 'text',
),
// text long
'field_hidden_text_long' => array(
'label' => t('Hidden long text'),
'description' => t('This field stores long text text in the database.'),
'settings' => array(
'max_length' => 10000,
),
'instance_settings' => array(
'text_processing' => 0,
),
'default_widget' => 'field_hidden',
'default_formatter' => 'hidden',
// alternative: field_hidden_text_plain ~ same as text (short)
'default_token_formatter' => 'field_hidden_text_plain',
// Tokens integration.
'property_type' => 'text',
),
// integer
'field_hidden_integer' => array(
'label' => t('Hidden integer'),
'description' => t('This field stores a number in the database as an integer.'),
'settings' => array(),
'instance_settings' => array(
'min' => '',
'max' => '',
'prefix' => '',
'suffix' => '',
),
'default_widget' => 'field_hidden',
'default_formatter' => 'hidden',
// alternative: field_hidden_integer
'default_token_formatter' => 'field_hidden_numeric_unformatted',
// Tokens integration.
'property_type' => 'integer',
),
// decimal
'field_hidden_decimal' => array(
'label' => t('Hidden decimal'),
'description' => t('This field stores a number in the database in a fixed decimal format.'),
'settings' => array(
'precision' => ($v = @ini_get('precision')) ? $v : 10,
// 10 ~ Number module's default.
'scale' => 2,
'decimal_separator' => '.',
),
'instance_settings' => array(
'min' => '',
'max' => '',
'prefix' => '',
'suffix' => '',
),
'default_widget' => 'field_hidden',
'default_formatter' => 'hidden',
// alternative: field_hidden_decimal
'default_token_formatter' => 'field_hidden_numeric_unformatted',
// Tokens integration.
'property_type' => 'decimal',
),
// float
'field_hidden_float' => array(
'label' => t('Hidden float'),
'description' => t('This field stores a number in the database in a floating point format'),
'settings' => array(
'decimal_separator' => '.',
),
'instance_settings' => array(
'min' => '',
'max' => '',
'prefix' => '',
'suffix' => '',
),
'default_widget' => 'field_hidden',
'default_formatter' => 'hidden',
// alternative: field_hidden_decimal (float uses same formatter as decimal)
'default_token_formatter' => 'field_hidden_numeric_unformatted',
// Tokens integration.
'property_type' => 'float',
),
);
}