entityconnect.install in Entity connect 8.2
Same filename and directory in other branches
Install, update and uninstall functions for the entityconnect module.
File
entityconnect.installView 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
Name | Description |
---|---|
entityconnect_update_8001 | Grant new permission to roles having 'access admin pages' permission. |