public function Name::matches in User restrictions 8
Check if the given data matches the restriction.
Parameters
array $data: Data to check.
Return value
bool TRUE if the value matches one of the restrictions, FALSE otherwise.
Overrides UserRestrictionTypeInterface::matches
File
- src/
Plugin/ UserRestrictionType/ Name.php, line 26
Class
- Name
- Defines a restriction type by username.
Namespace
Drupal\user_restrictions\Plugin\UserRestrictionTypeCode
public function matches(array $data) {
if (!isset($data['name'])) {
return FALSE;
}
$this->name = $data['name'];
$restriction = parent::matchesValue($this->name);
if ($restriction) {
$this->logger
->notice('Restricted name %name matching %restriction has been blocked.', [
'%name' => $this->name,
'%restriction' => $restriction
->toLink($restriction
->label(), 'edit-form'),
]);
}
return $restriction;
}