You are here

protected function AgreementForm::notify in Agreement 8.2

Same name and namespace in other branches
  1. 3.0.x src/Form/AgreementForm.php \Drupal\agreement\Form\AgreementForm::notify()

Notify email recipient if provided.

Parameters

\Drupal\agreement\Entity\Agreement $agreement: The agreement entity.

\Drupal\Core\Session\AccountInterface $account: The user account.

string $mail: The email recipient.

string $key: The mail key to use.

1 call to AgreementForm::notify()
AgreementForm::submitForm in src/Form/AgreementForm.php
Form submission handler.

File

src/Form/AgreementForm.php, line 271

Class

AgreementForm
Agreement page form.

Namespace

Drupal\agreement\Form

Code

protected function notify(Agreement $agreement, AccountInterface $account, $mail = '', $key = 'notice') {
  if ($mail) {
    $params = [
      'context' => [
        'agreement' => $agreement,
      ],
      'account' => $account,
    ];
    $this->mailManager
      ->mail('agreement', $key, $mail, $account
      ->getPreferredAdminLangcode(), $params);
  }
}