You are here

function opigno_skills_system_install in Opigno module 3.x

Same name and namespace in other branches
  1. 8 modules/opigno_skills_system/opigno_skills_system.install \opigno_skills_system_install()

Implements hook_install().

File

modules/opigno_skills_system/opigno_skills_system.install, line 15
Install, update and uninstall functions for the Opigno skills system module.

Code

function opigno_skills_system_install($is_syncing) {
  if ($is_syncing) {
    return;
  }

  // Give an access to manage skills vocabulary.
  $role = Role::load('content_manager');
  $issueAccessPermissions = [
    'create terms in skills',
    'delete terms in skills',
    'edit terms in skills',
  ];
  foreach ($issueAccessPermissions as $permission) {
    $role
      ->grantPermission($permission);
  }
  try {
    $role
      ->save();
  } catch (EntityStorageException $e) {
    watchdog_exception('opigno_skills_system_exception', $e);
  }
}