You are here

protected static function GeneralUserReferenceFormatter::getUserReferenceTokenPatterns in Formatter Suite 8

Returns an array of mappings from formatting styles to token strings.

Return value

string[] Returns an associative array with internal names as keys and token strings as values.

1 call to GeneralUserReferenceFormatter::getUserReferenceTokenPatterns()
GeneralUserReferenceFormatter::viewElements in src/Plugin/Field/FieldFormatter/GeneralUserReferenceFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/GeneralUserReferenceFormatter.php, line 218

Class

GeneralUserReferenceFormatter
Formats a user entity reference as one or more links.

Namespace

Drupal\formatter_suite\Plugin\Field\FieldFormatter

Code

protected static function getUserReferenceTokenPatterns() {
  $last = (string) t('Last login');
  $since = (string) t('Since');
  return [
    'id' => '[user:uid]',
    'email' => '[user:mail]',
    'account' => '[user:account-name]',
    'account-id' => '[user:account-name] ([user:uid])',
    'account-email' => '[user:account-name] <[user:mail]>',
    'account-display' => '[user:account-name] ([user:display-name])',
    'account-roles' => '[user:account-name] ([user:roles])',
    'account-last' => '[user:account-name] (' . $last . ' [user:last-login])',
    'account-since' => '[user:account-name] (' . $since . ' [user:created])',
    'display' => '[user:display-name]',
    'display-id' => '[user:display-name] ([user:uid])',
    'display-email' => '[user:display-name] <[user:mail]>',
    'display-account' => '[user:display-name] ([user:account-name])',
    'display-roles' => '[user:display-name] ([user:roles])',
    'display-last' => '[user:display-name] (' . $last . ' [user:last-login])',
    'display-since' => '[user:display-name] (' . $since . ' [user:created])',
  ];
}