85 lines
2.9 KiB
Plaintext
85 lines
2.9 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();
|
|
|
|
// Add comment field to article node type.
|
|
\Drupal::service('comment.manager')->addDefaultField('node', 'article', 'comment', COMMENT_OPEN);
|
|
|
|
// Allow visitor account creation with administrative approval.
|
|
$user_settings = \Drupal::config('user.settings');
|
|
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
|
|
|
|
// 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 = entity_create('shortcut', array(
|
|
'shortcut_set' => 'default',
|
|
'title' => t('Add content'),
|
|
'weight' => -20,
|
|
'path' => 'node/add',
|
|
'langcode' => language_default()->id,
|
|
));
|
|
$shortcut->save();
|
|
|
|
$shortcut = entity_create('shortcut', array(
|
|
'shortcut_set' => 'default',
|
|
'title' => t('All content'),
|
|
'weight' => -19,
|
|
'path' => 'admin/content',
|
|
'langcode' => language_default()->id,
|
|
));
|
|
$shortcut->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();
|
|
}
|