Email.php in User restrictions 8
File
src/Plugin/UserRestrictionType/Email.php
View source
<?php
namespace Drupal\user_restrictions\Plugin\UserRestrictionType;
class Email extends UserRestrictionTypeBase {
protected $mail = '';
public function matches(array $data) {
if (!isset($data['mail'])) {
return FALSE;
}
$this->mail = $data['mail'];
$restriction = parent::matchesValue($this->mail);
if ($restriction) {
$this->logger
->notice('Restricted email %mail matching %restriction has been blocked.', [
'%mail' => $this->mail,
'%restriction' => $restriction
->toLink($restriction
->label(), 'edit-form'),
]);
}
return $restriction;
}
public function getErrorMessage() {
return $this
->t('The email %mail is reserved, and cannot be used.', [
'%mail' => $this->mail,
]);
}
}
Classes
Name |
Description |
Email |
Defines a restriction type by email. |