function imce_install in IMCE 8
Same name and namespace in other branches
- 8.2 imce.install \imce_install()
- 6.2 imce.install \imce_install()
- 6 imce.install \imce_install()
- 7 imce.install \imce_install()
Implements hook_install().
File
- ./
imce.install, line 13 - Manages installation and update of imce module.
Code
function imce_install() {
// Assign admin profile to administrators.
$admin_roles = \Drupal::entityQuery('user_role')
->condition('is_admin', TRUE)
->execute();
if ($admin_roles) {
$config = \Drupal::configFactory()
->getEditable('imce.settings');
$roles_profiles = $config
->get('roles_profiles') ?: [];
$wrappers = \Drupal::service('stream_wrapper_manager')
->getWrappers(StreamWrapperInterface::WRITE_VISIBLE);
foreach ($wrappers as $scheme => $info) {
foreach ($admin_roles as $role) {
$roles_profiles[$role][$scheme] = 'admin';
}
}
$config
->set('roles_profiles', $roles_profiles);
$config
->save(TRUE);
}
}