You are here

public function MobileNumberUtil::tfaAccountNumber in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::tfaAccountNumber()

Gets account mobile number if tfa was enabled for the user.

Parameters

int $uid: User id.

Return value

string International number

Overrides MobileNumberUtilInterface::tfaAccountNumber

File

src/MobileNumberUtil.php, line 386

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function tfaAccountNumber($uid) {
  $user = User::load($uid);
  $field_name = $this
    ->getTfaField();
  if ($this
    ->isTfaEnabled() && $field_name && !empty($user
    ->get($field_name)
    ->getValue()[0]['value']) && !empty($user
    ->get($field_name)
    ->getValue()[0]['tfa'])) {
    return $user
      ->get($field_name)
      ->getValue()[0]['value'];
  }
  return '';
}