function environment_indicator_check_access in Environment Indicator 8.2
Same name and namespace in other branches
- 7.2 environment_indicator.module \environment_indicator_check_access()
Helper function to check access to show the indicator.
Parameters
array: The environment info array.
Return value
boolean TRUE if the user can see the indicator.
1 call to environment_indicator_check_access()
- environment_indicator_page_build in ./
environment_indicator.module - Implements hook_page_build().
File
- ./
environment_indicator.module, line 282 - Module implementation file.
Code
function environment_indicator_check_access($environment_info) {
// Do not show the indicator on select pages.
$supress_pages = \Drupal::config('environment_indicator.options')
->get('suppress_pages');
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path(current_path(), $supress_pages);
if ($page_match) {
return FALSE;
}
return user_access('access environment indicator') || user_access('access environment indicator ' . $environment_info['machine']);
}