You are here

function _name_translations in Name Field 8

Same name and namespace in other branches
  1. 6 name.module \_name_translations()
  2. 7 name.module \_name_translations()

Static cache to reuse translated name components.

These have double encoding to allow easy and targeted string overrides.

Parameters

string[] $intersect: An array of field component keys of the translations required.

Return value

string[] Keyed array of the field component labels.

14 calls to _name_translations()
Name::getInfo in src/Element/Name.php
Returns the element properties for this element.
Name::preRender in src/Element/Name.php
This function themes the element and controls the title display.
NameFieldSettingsTrait::getDefaultNameFieldSettingsForm in src/Traits/NameFieldSettingsTrait.php
Returns a form for the default settings defined above.
NameFieldSettingsTrait::validateMinimumComponents in src/Traits/NameFieldSettingsTrait.php
Helper function to validate minimum components.
NameFieldTest::testFieldEntry in tests/src/Functional/NameFieldTest.php
The most basic test.

... See full list

File

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

Code

function _name_translations(array $intersect = NULL) {
  static $nt = NULL;
  if (!isset($nt)) {
    $nt = [
      'title' => t('@name_title', [
        '@name_title' => t('Title'),
      ]),
      'given' => t('@name_given', [
        '@name_given' => t('Given'),
      ]),
      'middle' => t('@name_middle', [
        '@name_middle' => t('Middle name(s)'),
      ]),
      'family' => t('@name_family', [
        '@name_family' => t('Family'),
      ]),
      'generational' => t('@name_generational', [
        '@name_generational' => t('Generational'),
      ]),
      'credentials' => t('@name_credentials', [
        '@name_credentials' => t('Credentials'),
      ]),
    ];
  }
  return empty($intersect) ? $nt : array_intersect_key($nt, $intersect);
}