You are here

function ulogin_token_info in uLogin (advanced version) 8

Same name and namespace in other branches
  1. 7 ulogin.tokens.inc \ulogin_token_info()

Implements hook_token_info().

1 call to ulogin_token_info()
_ulogin_rules_data_properties in ./ulogin.rules.inc
1 string reference to 'ulogin_token_info'
_ulogin_rules_data_properties in ./ulogin.rules.inc

File

./ulogin.tokens.inc, line 15
Builds placeholder replacement tokens for ulogin-related data.

Code

function ulogin_token_info() {
  $type = [
    'name' => t('uLogin data'),
    'description' => t('Information about the user from the uLogin service.'),
    'needs-data' => 'user',
  ];
  $tokens = [];
  $tokens['user']['ulogin'] = [
    'name' => t('uLogin information'),
    'description' => t('Information from uLogin service.'),
    'type' => 'ulogin',
  ];
  $tokens['ulogin'] = [
    'network' => [
      'name' => t('Authentication provider'),
      'description' => t('Network providing authentication.'),
    ],
    'uid' => [
      'name' => t('UID'),
      'description' => t('UID') . ' ' . t('provided by uLogin.'),
    ],
    'identity' => [
      'name' => t('Identity'),
      'description' => t('Identity') . ' ' . t('provided by uLogin.'),
    ],
    'photo_processed' => [
      'name' => t('Checked photo'),
      'description' => t('Big photo by default. If big photo is not available - then photo.'),
    ],
  ];
  foreach (UloginHelper::fieldsList() as $key => $value) {
    $tokens['ulogin'][$key] = [
      'name' => $value,
      'description' => $value . ' ' . t('provided by uLogin.'),
    ];
  }
  return [
    'types' => [
      'ulogin' => $type,
    ],
    'tokens' => [
      'ulogin' => $tokens['ulogin'],
      'user' => $tokens['user'],
    ],
  ];
}