You are here

public function MobileNumberItem::tfaAllowed in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldType/MobileNumberItem.php \Drupal\mobile_number\Plugin\Field\FieldType\MobileNumberItem::tfaAllowed()

Checks if tfa is allowed based on tfa module installation and field cardinality.

Return value

bool True or false.

1 call to MobileNumberItem::tfaAllowed()
MobileNumberItem::fieldSettingsForm in src/Plugin/Field/FieldType/MobileNumberItem.php
Returns a form for the field-level settings.

File

src/Plugin/Field/FieldType/MobileNumberItem.php, line 374

Class

MobileNumberItem
Plugin implementation of the 'mobile_number' field type.

Namespace

Drupal\mobile_number\Plugin\Field\FieldType

Code

public function tfaAllowed() {

  /** @var \Drupal\mobile_number\MobileNumberUtilInterface $util */
  $util = \Drupal::service('mobile_number.util');
  return $util
    ->isTfaEnabled() && $this
    ->getFieldDefinition()
    ->getFieldStorageDefinition()
    ->getCardinality() == 1;
}