public static function CleantalkFuncs::cleantalk_get_user_roles_default in Anti Spam by CleanTalk 9.1.x
Same name and namespace in other branches
- 8.4 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::cleantalk_get_user_roles_default()
- 8.3 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::cleantalk_get_user_roles_default()
1 call to CleantalkFuncs::cleantalk_get_user_roles_default()
- CleantalkSettingsForm::buildForm in src/
Form/ CleantalkSettingsForm.php - Form constructor.
File
- src/
CleantalkFuncs.php, line 719
Class
- CleantalkFuncs
- Cleantalk class create request
Namespace
Drupal\cleantalkCode
public static function cleantalk_get_user_roles_default() {
if (empty(\Drupal::config('cleantalk.settings')
->get('cleantalk_roles_exclusions'))) {
$roles = self::cleantalk_get_user_roles();
foreach ($roles as $role_id => $role_name) {
if (strpos('administrator', $role_id) === false) {
unset($roles[$role_id]);
}
}
return array_keys($roles);
}
else {
$roles = \Drupal::config('cleantalk.settings')
->get('cleantalk_roles_exclusions');
$config_roles = array();
foreach ((array) $roles as $role => $role_name) {
$config_roles[$role_name] = $role_name;
}
return $config_roles;
}
}