Name Field is a module that provides a CCK / Field Name element.
Features
- Select between one to five separate fields to capture a persons title, given (first), middle, family (surname), generational suffix and credentials (post-nominals).
- Name and name list formatters.
- Real / Display name: create an alternative screen name to the users login 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. (Drupal 7)
- Select or Text field support for Titles and Generational suffixes.
- Optional autocomplete options for all text fields
- Easier styling with component classes (Drupal 7 & 8) and RDFa support in conjunction with RDF UI (Drupal 8).
- Feeds, Migrate, Views (native and custom filter) and Devel Generate integration.
- Inline component markup formatting options. This can be found in the field formatting options.
- Formatter link options (Drupal 8).
- Nickname / preferred field support in the tokens. (Drupal 8).
- Alternative field replacement support in the tokens. Generic for custom use cases like needing a persons maiden name, etc (Drupal 8).
- Full Token module support for specific formatters or components with delta support. (Drupal 7)
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.
Developers
Requires dev version 20th March 2018.
Easily format a name or name list with a name formatter service:
\Drupal::service('name.formatter')->format($name_array, 'format_id');
\Drupal::service('name.formatter')->formatList($names_array, 'format_id', 'list_format_id');
// For generation of gender aware random names.
\Drupal::service('name.generator')->generateSampleNames(100, $field_definition = NULL);
Field Collections Warning
If you are planning to use the Field Collections module in Drupal 7, 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.
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.
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Content editing experience, Site structure, Developer tools
- 7,307 sites report using this module
- Created by alan d. on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 8.x-1.x-dev updated 2 Jan 2025 at 13:55 UTC