imce.install in IMCE 8
Same filename and directory in other branches
Manages installation and update of imce module.
File
imce.installView source
<?php
/**
* @file
* Manages installation and update of imce module.
*/
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
/**
* Implements hook_install().
*/
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);
}
}
/**
* Create image style for IMCE browser.
*/
function imce_update_8001() {
// Cancelled.
}
Functions
Name | Description |
---|---|
imce_install | Implements hook_install(). |
imce_update_8001 | Create image style for IMCE browser. |