groups/modules/commons/commons_misc/commons_misc.install

80 lines
2.0 KiB
Plaintext

<?php
/**
* @file
* Update hooks for commons_misc related functions.
*/
/**
* Implements hook_install().
*/
function commons_misc_install() {
// While the administrator role will be created by Features, it will not be
// available yet when hook_install() is run, so we need to test for and create
// it here.
if (!$role = user_role_load_by_name('administrator')) {
$role = new stdClass();
$role->name = 'administrator';
$role->weight = 10;
user_role_save($role);
}
// Grant user 1 the 'administrator' role.
user_multiple_role_edit(array(1), 'add_role', $role->rid);
// Set the 'administrator' role as the 'administrator role'.
variable_set('user_admin_role', $role->rid);
}
/**
* Enable legacy IE settings for Commons Origins.
*/
function commons_misc_update_7000() {
// Pull the existing settings for Commons Origins so that any changes by the
// user are preserved.
$settings = variable_get('theme_commons_origins_settings', array());
// Prevent IE from falling into compatibility mode.
$settings['chrome_edge'] = 1;
// Enable cleartype in IE.
$settings['clear_type'] = 1;
// Save the new Commons Origins settings.
variable_set('theme_commons_origins_settings', $settings);
}
/**
* Assign the administrator role a larger weight.
*/
function commons_misc_update_7001() {
$revert = array(
'commons_misc' => array('user_role'),
);
features_revert($revert);
return array();
}
/**
* Configure navbar to use the source version of Modernizr since it isn't
* currently possible to include a minified version of the library.
*/
function commons_misc_update_7002() {
$revert = array(
'commons_misc' => array('variable'),
);
features_revert($revert);
return array();
}
/**
* Ensure that the theme settings are up-to-date with the latest version of
* Adaptive Theme and fix Commons Misc appearing overridden.
*/
function commons_misc_update_7003() {
$revert = array(
'commons_misc' => array('variable'),
);
features_revert($revert);
return array();
}