You are here

private function AdminSettingsForm::setFormMessage in Acquia Lift Connector 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::setFormMessage()

Sets form message.

MessengerInterface was introduced by Drupal 8.5. This code is for backwards-compatibility to 8.4 and below.

Parameters

string $message: Message to show on form.

string $type: Type of the message to show on form.

2 calls to AdminSettingsForm::setFormMessage()
AdminSettingsForm::checkConnection in src/Form/AdminSettingsForm.php
Check URL's connection.
AdminSettingsForm::preValidateData in src/Form/AdminSettingsForm.php
Pre-validate data.

File

src/Form/AdminSettingsForm.php, line 694

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

private function setFormMessage($message, $type) {
  if (!$this->messenger) {
    drupal_set_message($message, $type);
    return;
  }
  $messengerFunctionName = 'add' . ucwords($type);
  $this->messenger
    ->{$messengerFunctionName}($message);
}