You are here

public function MobileNumberItem::fieldSettingsFormSubmit 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::fieldSettingsFormSubmit()

Submit callback for mobile number field item.

Parameters

array $form: Complete form.

\Drupal\Core\Form\FormStateInterface $form_state: Form state.

File

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

Class

MobileNumberItem
Plugin implementation of the 'mobile_number' field type.

Namespace

Drupal\mobile_number\Plugin\Field\FieldType

Code

public function fieldSettingsFormSubmit(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\mobile_number\MobileNumberUtilInterface $util */
  $util = \Drupal::service('mobile_number.util');
  $settings = $this
    ->getSettings();
  if (!empty([
    'message',
  ])) {
    t($settings['message']);
  }
  $tfa = !empty($this
    ->getSetting('tfa'));
  $field_name = $this
    ->getFieldDefinition()
    ->getName();
  if (!empty($tfa)) {
    $util
      ->setTfaField($field_name);
  }
  elseif ($field_name === $util
    ->getTfaField()) {
    $util
      ->setTfaField('');
  }
}