function google_optimize_hide_page_roles in Google Optimize 8
The list of roles to add the snippet.
Return value
array hide_page_roles
2 calls to google_optimize_hide_page_roles()
- GoogleOptimizeAdminSettingsForm::buildForm in src/
Form/ GoogleOptimizeAdminSettingsForm.php - Form constructor.
- google_optimize_hide_page_active in ./
google_optimize.module - Whether to put the snippet on the page.
File
- ./
google_optimize.module, line 111 - google_optimize.module
Code
function google_optimize_hide_page_roles() {
$config = \Drupal::config('google_optimize.settings');
$roles = $config
->get('hide_page_roles') ?: [];
foreach ($roles as $key => $value) {
if (!$value) {
unset($roles[$key]);
}
}
return $roles;
}