You are here

public function NameFormatterInterface::format in Name Field 8

Formats an array of name components.

Parameters

array $components: An array of name components to format.

The expected components are:

  • title (string)
  • given (string)
  • middle (string)
  • family (string)
  • generational (string)
  • credentials (string)

The following tokens are also supported:

  • preferred (string)
  • alternative (string)

string $type: (optional) The name format type to load. If the format does not exist, the 'default' format is used. Defaults to 'default'.

string|null $langcode: (optional) Language code to translate to. NULL (default) means to use the user interface language for the page.

Return value

\Drupal\Component\Render\MarkupInterface A renderable object representing the name.

1 method overrides NameFormatterInterface::format()
NameFormatter::format in src/NameFormatter.php
Formats an array of name components.

File

src/NameFormatterInterface.php, line 37

Class

NameFormatterInterface
Provides an interface defining a name formatter.

Namespace

Drupal\name

Code

public function format(array $components, $type = 'default', $langcode = NULL);