varbase.install in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 7
Same filename and directory in other branches
Install, update and uninstall functions for the Vardot Base install profile.
File
varbase.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Vardot Base install profile.
*/
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function varbase_install() {
// Default "Basic page" to not be promoted.
variable_set('node_options_page', array(
'status',
));
// Don't display date and author information for "Basic page" nodes by default.
variable_set('node_submitted_page', FALSE);
// Disable user picture support.
variable_set('user_pictures', '0');
// Allow visitor account creation with administrative approval.
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
// Enable default permissions for system roles.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access content',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access content',
));
// Projects to disable.
$dis_module = array(
"toolbar",
"overlay",
);
// Disable Projects.
db_update('system')
->fields(array(
'status' => 0,
))
->condition('name', $dis_module, 'IN')
->execute();
//themes to enable
$en_theme = array(
'ember',
'bootstrap',
'vartheme2',
);
theme_enable($en_theme);
// Set admin theme
variable_set('admin_theme', 'ember');
variable_set('node_admin_theme', '1');
// Set default theme
variable_set('theme_default', 'vartheme2');
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'Super admin';
$admin_role->weight = 4;
if ($role = user_role_load_by_name($admin_role->name)) {
$admin_role = $role;
}
else {
user_role_save($admin_role);
}
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
//Create a other roles for specific site administration tasks.
$content_role = new stdClass();
$content_role->name = 'Content admin';
$content_role->weight = 2;
if (!($role = user_role_load_by_name($content_role->name))) {
user_role_save($content_role);
}
$site_admin_role = new stdClass();
$site_admin_role->name = 'Site admin';
$site_admin_role->weight = 3;
if (!($role = user_role_load_by_name($site_admin_role->name))) {
user_role_save($content_role);
}
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array(
'uid' => 1,
'rid' => $admin_role->rid,
))
->execute();
// Insert default pre-defined node types into the database. For a complete
// list of available node type attributes, refer to the node type API
// documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
$types = array(
array(
'type' => 'page',
'name' => st('Basic page'),
'base' => 'node_content',
'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
}
/** VarBase: Module Configs **/
// jQuery Update
variable_set('jquery_update_jquery_version', '1.8');
variable_set('jquery_update_jquery_cdn', 'jquery');
// External Links Config
variable_set('extlink_class', '0');
variable_set('extlink_target', '_blank');
}
Functions
Name![]() |
Description |
---|---|
varbase_install | Implements hook_install(). |