function name_field_info in Name Field 7
Same name and namespace in other branches
- 6 name.module \name_field_info()
Implements hook_field_info().
1 call to name_field_info()
- name_element_info in ./
name.module - Implements hook_element_info().
File
- ./
name.module, line 876 - Defines an API for displaying and inputing names.
Code
function name_field_info() {
$parts = _name_translations();
$keys = array_keys($parts);
$count = count($keys);
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.'),
'default_widget' => 'name_widget',
'default_formatter' => 'name_formatter',
'settings' => array(
// Components used. At least given or family name is required.
'components' => drupal_map_assoc($keys),
// Minimal set of components before considered incomplete.
'minimum_components' => array(
'given' => 'given',
'family' => 'family',
),
// Allows a given or family component value to filful either both the
// minimal components. Allows singular names like "Prince".
'allow_family_or_given' => 0,
'labels' => _name_translations(),
'max_length' => array(
'title' => 31,
'given' => 63,
'middle' => 127,
'family' => 63,
'generational' => 15,
'credentials' => 255,
),
'autocomplete_source' => array(
'title' => array(
'title',
),
'given' => array(),
'middle' => array(),
'family' => array(),
'generational' => array(
'generation',
),
'credentials' => array(),
),
'autocomplete_separator' => array(
'title' => ' ',
'given' => ' -',
'middle' => ' -',
'family' => ' -',
'generational' => ' ',
'credentials' => ', ',
),
'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',
'size' => array(
'title' => 6,
'given' => 20,
'middle' => 20,
'family' => 20,
'generational' => 5,
'credentials' => 35,
),
'inline_css' => array_combine($keys, array_fill(0, $count, '')),
'title_display' => array_combine($keys, array_fill(0, $count, 'description')),
// Field instance overrides.
'components' => array(),
'minimum_components' => array(),
'labels' => array_combine($keys, array_fill(0, $count, '')),
// New settings to override the user name. Only applies to user entities.
'override_format' => 'default',
'preferred_field_reference' => '',
// Prevents the default break between the name components and credentials.
'credentials_inline' => 0,
'component_css' => '',
'component_layout' => 'default',
'show_component_required_marker' => 0,
),
'property_type' => 'field_item_name',
'property_callbacks' => array(
'name_field_property_info_callback',
),
),
);
}