You are here

function name_field_info in Name Field 6

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

Implementation of hook_field_info().

2 calls to name_field_info()
name_elements in ./name.module
Implementation of hook_elements().
_name_defaults in ./name.module
Helper function to set the defaults for a name field / widget.

File

./name.module, line 549
Defines an API for displaying and inputing names.

Code

function name_field_info() {
  return array(
    'name' => array(
      'label' => t('Name'),
      'description' => t('This field stores a users title, given, middle, family name, generational suffix and credentials in the database.'),
      'field_settings' => array(
        // Components used. At least given or family name is required.
        'components' => array(
          'title',
          'given',
          'middle',
          'family',
          'generational',
          'credentials',
        ),
        // Minimal set of components before considered incomplete
        'minimum_components' => array(
          'given',
          'family',
        ),
        'labels' => _name_translations(),
        'max_length' => array(
          'title' => 31,
          'given' => 63,
          'middle' => 127,
          'family' => 63,
          'generational' => 15,
          'credentials' => 255,
        ),
        'title_options' => implode("\n", array(
          t('-- --'),
          t('Mr.'),
          t('Mrs.'),
          t('Miss'),
          t('Ms.'),
          t('Dr.'),
          t('Prof.'),
        )),
        'generational_options' => implode("\n", array(
          t('-- --'),
          t('Jr.'),
          t('Sr.'),
          t('I'),
          t('II'),
          t('III'),
          t('IV'),
          t('V'),
          t('VI'),
          t('VII'),
          t('VIII'),
          t('IX'),
          t('X'),
        )),
        'sort_options' => array(
          'title' => 'title',
          'generational' => 0,
        ),
      ),
      'instance_settings' => array(
        // Possible elements for either (free) text, autocomplete, select.
        'title_field' => 'select',
        'generational_field' => 'select',
        'inline_css' => array(
          'multiplier' => '0.9',
          'unit' => 'em',
        ),
        'size' => array(
          'title' => 6,
          'given' => 20,
          'middle' => 20,
          'family' => 20,
          'generational' => 5,
          'credentials' => 35,
        ),
        'inline_css_enabled' => array(
          'title' => 0,
          'given' => 0,
          'middle' => 0,
          'family' => 0,
          'generational' => 0,
          'credentials' => 0,
        ),
        'title_display' => array(
          'title' => 'description',
          'given' => 'description',
          'middle' => 'description',
          'family' => 'description',
          'generational' => 'description',
          'credentials' => 'description',
        ),
      ),
    ),
  );
}