You are here

function matomo_install in Matomo Analytics 8

Same name and namespace in other branches
  1. 7.2 matomo.install \matomo_install()

Implements hook_install().

File

./matomo.install, line 14
Installation file for Matomo Analytics module.

Code

function matomo_install() {

  // Make the default install more user and GDPR friendly.
  $role = Role::load('authenticated');
  $role
    ->grantPermission('opt-in or out of matomo tracking');
  $success = $role
    ->save();
  if ($success) {
    $messenger = \Drupal::messenger();
    $messenger
      ->addMessage(t('Module %module granted %permission permission to authenticated users.', [
      '%module' => 'Matomo Analytics',
      '%permission' => t('Opt-in or out of tracking'),
    ]), 'status');
  }
}