public function AccessStorage::checkIfUsersExists in Permissions by Term 8.2
Same name and namespace in other branches
- 8 src/Service/AccessStorage.php \Drupal\permissions_by_term\Service\AccessStorage::checkIfUsersExists()
Parameters
FormState $form_state:
File
- src/
Service/ AccessStorage.php, line 88
Class
- AccessStorage
- Class AccessStorage.
Namespace
Drupal\permissions_by_term\ServiceCode
public function checkIfUsersExists(FormState $form_state) {
$sAllowedUsers = $form_state
->getValue('access')['user'];
$aAllowedUsers = Tags::explode($sAllowedUsers);
foreach ($aAllowedUsers as $sUserId) {
$aUserId = \Drupal::entityQuery('user')
->condition('uid', $sUserId)
->execute();
if (empty($aUserId)) {
$form_state
->setErrorByName('access][user', t('The user with ID %user_id does not exist.', [
'%user_id' => $sUserId,
]));
}
}
}