You are here

function machine_name_field_info in Machine name 7.2

Same name and namespace in other branches
  1. 7 machine_name.module \machine_name_field_info()

Implements hook_field_info().

File

./machine_name.module, line 12
Defines a machine name field type, relying on Form API's #type 'machine_name'.

Code

function machine_name_field_info() {
  return array(
    'machine_name' => array(
      'label' => t('Machine name'),
      'description' => t('This field stores varchar text in the database.'),
      'settings' => array(
        'max_length' => 128,
        'replace_pattern' => '[^a-z0-9_]+',
        'replace' => '_',
      ),
      'instance_settings' => array(),
      'default_widget' => 'machine_name_default',
      'default_formatter' => 'machine_name_default',
      // Expose the field as text for the Entity metadata framework.
      'property_type' => 'text',
    ),
  );
}