You are here

entityconnect.install in Entity connect 8.2

Same filename and directory in other branches
  1. 7.2 entityconnect.install
  2. 7 entityconnect.install

Install, update and uninstall functions for the entityconnect module.

File

entityconnect.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the entityconnect module.
 */
use Drupal\user\Entity\Role;

/**
 * Grant new permission to roles having 'access admin pages' permission.
 */
function entityconnect_update_8001() {
  $roles_changed = [];

  /** @var \Drupal\user\RoleInterface[] $roles */
  $roles = Role::loadMultiple();
  foreach ($roles as $roleObj) {
    if ($roleObj
      ->hasPermission('access administration pages')) {
      $roleObj
        ->grantPermission('administer entityconnect');
      $roleObj
        ->save();
      $roles_changed[] = $roleObj
        ->label();
    }
  }
  return t('The "administer entityconnect" permission was granted to roles: %r.', [
    '%r' => implode(', ', $roles_changed),
  ]);
}

Functions

Namesort descending Description
entityconnect_update_8001 Grant new permission to roles having 'access admin pages' permission.