You are here

protected function SettingsForm::dataEmptyCheck in Two-factor Authentication (TFA) 8

Check whether the given data is empty and set appropriate message.

Parameters

array $data: Data to be checked.

string $message: Error message to show if data is empty.

Return value

bool TRUE if data is empty otherwise FALSE.

1 call to SettingsForm::dataEmptyCheck()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

src/Form/SettingsForm.php, line 464

Class

SettingsForm
The admin configuration page.

Namespace

Drupal\tfa\Form

Code

protected function dataEmptyCheck(array $data, $message) {
  if (empty($data)) {
    $this
      ->messenger()
      ->addError($message);
    return TRUE;
  }
  return FALSE;
}