function _environment_indicator_external_integration_is_enabled in Environment Indicator 8.3
Same name and namespace in other branches
- 4.x environment_indicator.module \_environment_indicator_external_integration_is_enabled()
Helper function that checks if there is external integration.
Parameters
string $integration: Name of the integration: toolbar, admin_menu, ...
Return value
bool TRUE if integration is enabled. FALSE otherwise.
2 calls to _environment_indicator_external_integration_is_enabled()
- environment_indicator_page_top in ./
environment_indicator.module - Implements hook_page_top().
- environment_indicator_toolbar in ./
environment_indicator.module - Implements hook_toolbar().
File
- ./
environment_indicator.module, line 316 - Module implementation file.
Code
function _environment_indicator_external_integration_is_enabled($integration) {
if ($integration == 'toolbar') {
$access = \Drupal::moduleHandler()
->moduleExists('toolbar');
$toolbar_integration = \Drupal::config('environment_indicator.settings')
->get('toolbar_integration') ?? [];
$access = $access && in_array('toolbar', $toolbar_integration);
$access = $access && \Drupal::currentUser()
->hasPermission('access toolbar');
return $access;
}
return FALSE;
}