You are here

function opigno_dashboard_install in Opigno dashboard 3.x

Same name and namespace in other branches
  1. 8 opigno_dashboard.install \opigno_dashboard_install()

Implements hook_install().

File

./opigno_dashboard.install, line 44
Install, update and uninstall functions for the alt_aero_log_contacts module.

Code

function opigno_dashboard_install() {
  $blocks = \Drupal::config('opigno_dashboard.settings')
    ->get('blocks');

  // Create block instances.
  \Drupal::service('opigno_dashboard.block')
    ->createBlocksInstances($blocks);

  // Grant 'opigno dashboard layout access' permission.
  $roles = Role::loadMultiple();
  foreach ($roles as $role) {
    $role
      ->grantPermission('opigno dashboard layout access');
    try {
      $role
        ->save();
    } catch (EntityStorageException $e) {
      watchdog_exception('opigno_dashboard_exception', $e);
    }
  }
}