You are here

public function MobileNumberUtil::getTfaField in Mobile Number 2.0.x

Same name and namespace in other branches
  1. 8 src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::getTfaField()

Gets the tfa field configuration.

Return value

string Currently configured user field for tfa. '' if not set or tfa is not enabled.

Overrides MobileNumberUtilInterface::getTfaField

1 call to MobileNumberUtil::getTfaField()
MobileNumberUtil::tfaAccountNumber in src/MobileNumberUtil.php
Gets account mobile number if tfa was enabled for the user.

File

src/MobileNumberUtil.php, line 403

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function getTfaField() {
  $tfa_field = $this->configFactory
    ->get('mobile_number.settings')
    ->get('tfa_field');
  $user_fields = $this->fieldMananger
    ->getFieldDefinitions('user', 'user');
  return $this
    ->isTfaEnabled() && !empty($user_fields[$tfa_field]) ? $tfa_field : '';
}