-
Notifications
You must be signed in to change notification settings - Fork 1
/
provider_stripe.module
31 lines (27 loc) · 988 Bytes
/
provider_stripe.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* @file
* Contains provider_stripe.module.
*/
use Drupal\Core\Messenger\MessengerInterface;
/**
* Implements hook_preprocess_HOOK().
*/
function provider_stripe_preprocess_page(&$variables) {
$admin_context = \Drupal::service('router.admin_context');
if ($admin_context->isAdminRoute()) {
$user_roles = \Drupal::currentUser()->getRoles();
if (in_array('administrator', $user_roles)) {
/** @var \Drupal\provider_stripe\StripeApiService $stripe_api **/
$stripe_api = \Drupal::service('provider_stripe.stripe_api');
if ($stripe_api->getMode() === 'test') {
\Drupal::messenger()
->addMessage(t('Provider Stripe is running in test mode.'),
MessengerInterface::TYPE_WARNING);
}
}
}
// $module_data = \Drupal::config('core.extension')->get('module');
// unset($module_data['subscription_manager']);
// \Drupal::configFactory()->getEditable('core.extension')->set('module', $module_data)->save();
}