1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Install, update and uninstall functions for the Media WYSIWYG module.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_uninstall().
|
10
|
*/
|
11
|
function media_wysiwyg_uninstall() {
|
12
|
// Remove variables.
|
13
|
variable_del('media_wysiwyg_wysiwyg_title');
|
14
|
variable_del('media_wysiwyg_wysiwyg_icon_title');
|
15
|
variable_del('media_wysiwyg_wysiwyg_default_view_mode');
|
16
|
variable_del('media_wysiwyg_wysiwyg_upload_directory');
|
17
|
variable_del('media_wysiwyg_wysiwyg_allowed_types');
|
18
|
variable_del('media_wysiwyg_wysiwyg_allowed_attributes');
|
19
|
variable_del('media_wysiwyg_wysiwyg_browser_plugins');
|
20
|
}
|
21
|
|
22
|
/**
|
23
|
* Implements hook_update_dependencies().
|
24
|
*/
|
25
|
function media_wysiwyg_update_dependencies() {
|
26
|
// Ensure the "access media browser" permission is granted to users before
|
27
|
// using it to grant the "use media wysiwyg" permission.
|
28
|
$dependencies['media_wysiwyg'][7201] = array(
|
29
|
'media' => 7226,
|
30
|
);
|
31
|
}
|
32
|
|
33
|
/**
|
34
|
* Grant existing user access to new media wysiwyg permission.
|
35
|
*/
|
36
|
function media_wysiwyg_update_7201() {
|
37
|
$roles = user_roles(TRUE, 'access media browser');
|
38
|
foreach ($roles as $rid => $role) {
|
39
|
user_role_grant_permissions($rid, array('use media wysiwyg'));
|
40
|
}
|
41
|
|
42
|
return t('Use Media WYSIWYG permission was granted to: @roles.', array(
|
43
|
'@roles' => check_plain(implode(', ', $roles)),
|
44
|
));
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* Use the legacy file entity rendering method for existing sites.
|
49
|
*
|
50
|
* Existing sites can change this setting at admin/config/media/browser.
|
51
|
*/
|
52
|
function media_wysiwyg_update_7202() {
|
53
|
variable_set('media_wysiwyg_default_render', 'field_attach');
|
54
|
}
|