function taxonomy_permissions_install in Taxonomy Permissions 8
Same name and namespace in other branches
- 7 taxonomy_permissions.install \taxonomy_permissions_install()
Implements hook_install().
File
- ./
taxonomy_permissions.install, line 14 - Install, update and uninstall functions for the taxonomy_permissions module.
Code
function taxonomy_permissions_install() {
// Give 'view terms' access to all vocabularies to all users to avoid
// surprises upon installation.
$perms = [];
$vocabularies = Vocabulary::loadMultiple();
foreach ($vocabularies as $id => $vocabulary) {
$perms[] = 'view terms in ' . $id;
}
if ($perms) {
user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, $perms);
user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, $perms);
}
}