90 lines
3.0 KiB
Plaintext
90 lines
3.0 KiB
Plaintext
<?php
|
|
/**
|
|
* @file
|
|
* Install, update and uninstall functions for the standard installation profile.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_install().
|
|
*
|
|
* Perform actions to set up the site for this profile.
|
|
*
|
|
* @see system_install()
|
|
*/
|
|
function standard_install() {
|
|
// Enable Bartik theme and set it as default theme instead of Stark.
|
|
// @see system_install()
|
|
$default_theme = 'bartik';
|
|
Drupal::config('system.theme')
|
|
->set('default', $default_theme)
|
|
->save();
|
|
theme_enable(array($default_theme));
|
|
theme_disable(array('stark'));
|
|
|
|
// Set front page to "node".
|
|
Drupal::config('system.site')->set('page.front', 'node')->save();
|
|
|
|
// Default "Basic page" to have comments disabled.
|
|
variable_set('comment_page', COMMENT_NODE_HIDDEN);
|
|
|
|
// Allow visitor account creation with administrative approval.
|
|
$user_settings = Drupal::config('user.settings');
|
|
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
|
|
|
|
// Create user picture field.
|
|
module_load_install('user');
|
|
user_install_picture_field();
|
|
|
|
// Enable default permissions for system roles.
|
|
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments'));
|
|
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval'));
|
|
|
|
// Enable all permissions for the administrator role.
|
|
user_role_grant_permissions('administrator', array_keys(Drupal::moduleHandler()->invokeAll('permission')));
|
|
// Set this as the administrator role.
|
|
$user_settings->set('admin_role', 'administrator')->save();
|
|
|
|
// Assign user 1 the "administrator" role.
|
|
db_insert('users_roles')
|
|
->fields(array('uid' => 1, 'rid' => 'administrator'))
|
|
->execute();
|
|
|
|
// Create a Home link in the main menu.
|
|
$menu_link = entity_create('menu_link', array(
|
|
'link_title' => t('Home'),
|
|
'link_path' => '<front>',
|
|
'menu_name' => 'main',
|
|
));
|
|
$menu_link->save();
|
|
|
|
// Enable the Contact link in the footer menu.
|
|
menu_link_maintain('system', 'enable', 'contact');
|
|
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
|
|
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access site-wide contact form'));
|
|
|
|
// Populate the default shortcut set.
|
|
$shortcut_set = shortcut_set_load('default');
|
|
$menu_link = entity_create('menu_link', array(
|
|
'link_path' => 'node/add',
|
|
'link_title' => t('Add content'),
|
|
'weight' => -20,
|
|
));
|
|
$menu_link->save();
|
|
$shortcut_set->links[$menu_link->uuid()] = $menu_link;
|
|
|
|
$menu_link = entity_create('menu_link', array(
|
|
'link_path' => 'admin/content',
|
|
'link_title' => t('All content'),
|
|
'weight' => -19,
|
|
));
|
|
$menu_link->save();
|
|
$shortcut_set->links[$menu_link->uuid()] = $menu_link;
|
|
|
|
$shortcut_set->save();
|
|
|
|
// Enable the admin theme.
|
|
theme_enable(array('seven'));
|
|
Drupal::config('system.theme')->set('admin', 'seven')->save();
|
|
Drupal::config('node.settings')->set('use_admin_theme', '1')->save();
|
|
}
|