Name Field

Component ID

589144

Component name

Name Field

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

145140

Component created

Component changed

Component body

Name Field is a module that provides a CCK / Field Name element.

Drupal 7 features

  • Real name: Uses the new Drupal hook for creating an alternative screen name to the users user name. To enable this feature, simply add a name field to the user bundle and enable this feature when configuring the field.
  • Webform component: Adds a name component to the webform components list.
  • Text field support for Titles and Generational suffixes.
  • Optional autocomplete options for all text fields
  • Field inline CCS style options were added for the individual components.
    Formatter component classes (in SPAN tags) are optionally additions.
  • Feeds, Name DB (100,000 weighted), Migrate, Views (native and custom filter) and Devel Generate integration.
    There has been a request to remove Migrate support as Migrate Extras also handles this field. Please supply feedback if you use Migrate and this module.
  • Inline component markup formatting options. This can be found in the field formatting options.
  • Full Token module support for specific formatters or components with delta support.

Drupal 6 features

  • Each field type consists of one or more of components from the following list:
    Title, Given name, Middle names, Family names, Generational suffix, Credentials. Almost any combination of these elements are allowed, but minimally, given or family must be selected.
  • Multiple configuration options for these, including:
    • Configurable titles
    • Maximum size limit, from 1 to 255
    • Optional title placement per element: above, below or hidden.
    • Specify the minimal number of components required per field, for example title and given.
    • Title and generational suffixes are select lists. On top of field options, the module provides taxonomic integration for these.
    • Dynamic CSS width display based on the size. Dropped for direct CCS styles in Drupal 7 version.
  • Unlimited number of display formatters.

    From version 6.x-1.3 it includes an internal parser to generate an infinite number of possible formats to display names in using custom name format strings.
  • Native views module support
  • Token module support
  • Multiple values are supported via the core fields engine

Custom name format strings

These formatters can be as simple as E which will print either the family name, or the given name if the family name is empty.

They can be fairly complicated for specific requirements, such as t+ LG((f-,)+ (x-.)+ (y-.))+ (=[Uc-]). This prints the title, the family name with the first letter in uppercase, the initials of the first and middle names in uppercase, followed by the credentials in uppercase, wrapped in square brackets. This could print something like "Mr Doe, J. J. [B.SC., PH.D.]" for a person that has filled out all fields, to just "J." for a person that only filled out their first name.

Post a support request if you need help creating a custom name format string.

Related projects

CCK Fullname for Drupal 5.x and 6.x
Namefield for Drupal 5.x (obsolete)

There is no tested upgrade path yet from Drupal 6. Please report any issues.

Field Collections

If you are planning to use the Field Collections module, never create a field with the machine name "field_name".

Any field with this machine name will conflict with that module, irrespective of the field type.

Updating

Version 7.x-1.5 introduced theme_name_component(). This was dropped in 7.x-1.8.

Note to any Features module users
Version 7.x-1.8 created a fatal error with Features 7.x-2.x due to an obscure core FAPI limitation / bug in the create features form.
Version 7.x-1.9 was quickly re-rolled to fix this, but this broke the new export functionality. This has since been fixed in the latest dev release.

Name 8.x-1.x

Big thanks to webflo who has done a lot of work porting the module to Drupal 8.x.

Please report any issues to the queues.