function language_access_install in Language access 8
Implements hook_install().
File
- ./
language_access.install, line 14 - The install and update code for language_access.
Code
function language_access_install() {
$default_language = \Drupal::languageManager()
->getDefaultLanguage();
/** @var \Drupal\user\RoleInterface[] $roles */
$roles = Role::loadMultiple([
RoleInterface::ANONYMOUS_ID,
RoleInterface::AUTHENTICATED_ID,
]);
foreach ($roles as $role) {
$role
->grantPermission('access language ' . $default_language
->getId())
->save();
}
}