2009-08-21 07:50:08 +00:00
|
|
|
<?php
|
2012-02-29 21:19:26 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2012-10-05 16:11:15 +00:00
|
|
|
* Install, update and uninstall functions for the standard installation profile.
|
2012-02-29 21:19:26 +00:00
|
|
|
*/
|
2009-08-21 07:50:08 +00:00
|
|
|
|
|
|
|
/**
|
2009-12-04 16:49:48 +00:00
|
|
|
* Implements hook_install().
|
2009-08-21 07:50:08 +00:00
|
|
|
*
|
|
|
|
* Perform actions to set up the site for this profile.
|
2012-02-29 21:19:26 +00:00
|
|
|
*
|
|
|
|
* @see system_install()
|
2009-08-21 07:50:08 +00:00
|
|
|
*/
|
2010-01-04 23:08:34 +00:00
|
|
|
function standard_install() {
|
2011-12-13 03:29:45 +00:00
|
|
|
// Enable Bartik theme and set it as default theme instead of Stark.
|
|
|
|
// @see system_install()
|
|
|
|
$default_theme = 'bartik';
|
2013-09-16 03:58:06 +00:00
|
|
|
\Drupal::config('system.theme')
|
2013-03-04 14:04:05 +00:00
|
|
|
->set('default', $default_theme)
|
|
|
|
->save();
|
2011-12-13 03:29:45 +00:00
|
|
|
theme_enable(array($default_theme));
|
|
|
|
theme_disable(array('stark'));
|
|
|
|
|
2012-01-08 07:14:15 +00:00
|
|
|
// Set front page to "node".
|
2013-09-16 03:58:06 +00:00
|
|
|
\Drupal::config('system.site')->set('page.front', 'node')->save();
|
2012-01-08 07:14:15 +00:00
|
|
|
|
2013-09-27 15:34:47 +00:00
|
|
|
// Add comment field to article node type.
|
|
|
|
\Drupal::service('comment.manager')->addDefaultField('node', 'article', 'comment', COMMENT_OPEN);
|
2009-08-21 07:50:08 +00:00
|
|
|
|
2010-05-27 12:29:39 +00:00
|
|
|
// Allow visitor account creation with administrative approval.
|
2013-09-16 03:58:06 +00:00
|
|
|
$user_settings = \Drupal::config('user.settings');
|
2012-08-26 21:15:58 +00:00
|
|
|
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
|
2010-05-27 12:29:39 +00:00
|
|
|
|
2009-08-27 20:25:29 +00:00
|
|
|
// Enable default permissions for system roles.
|
2013-01-17 22:22:50 +00:00
|
|
|
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'));
|
2009-08-27 20:25:29 +00:00
|
|
|
|
Issue #1479454 by Hugo Wetterberg, galooph, andypost, marcingy, heyrocker, larowlan, alexpott, tim.plunkett, fubhy, sun, dawehner: Convert user roles to configurables.
2013-01-19 21:53:56 +00:00
|
|
|
// Enable all permissions for the administrator role.
|
2013-09-16 03:58:06 +00:00
|
|
|
user_role_grant_permissions('administrator', array_keys(\Drupal::moduleHandler()->invokeAll('permission')));
|
2009-08-21 07:50:08 +00:00
|
|
|
// Set this as the administrator role.
|
Issue #1479454 by Hugo Wetterberg, galooph, andypost, marcingy, heyrocker, larowlan, alexpott, tim.plunkett, fubhy, sun, dawehner: Convert user roles to configurables.
2013-01-19 21:53:56 +00:00
|
|
|
$user_settings->set('admin_role', 'administrator')->save();
|
2009-08-21 07:50:08 +00:00
|
|
|
|
2010-05-16 10:41:04 +00:00
|
|
|
// Assign user 1 the "administrator" role.
|
|
|
|
db_insert('users_roles')
|
Issue #1479454 by Hugo Wetterberg, galooph, andypost, marcingy, heyrocker, larowlan, alexpott, tim.plunkett, fubhy, sun, dawehner: Convert user roles to configurables.
2013-01-19 21:53:56 +00:00
|
|
|
->fields(array('uid' => 1, 'rid' => 'administrator'))
|
2010-05-16 10:41:04 +00:00
|
|
|
->execute();
|
|
|
|
|
2010-07-22 23:39:14 +00:00
|
|
|
// Create a Home link in the main menu.
|
2013-02-08 23:55:25 +00:00
|
|
|
$menu_link = entity_create('menu_link', array(
|
2013-06-17 13:35:07 +00:00
|
|
|
'link_title' => t('Home'),
|
2010-07-22 23:39:14 +00:00
|
|
|
'link_path' => '<front>',
|
2012-10-25 15:53:18 +00:00
|
|
|
'menu_name' => 'main',
|
2013-02-08 23:55:25 +00:00
|
|
|
));
|
|
|
|
$menu_link->save();
|
2010-07-22 23:39:14 +00:00
|
|
|
|
2012-11-20 11:36:51 +00:00
|
|
|
// 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'));
|
|
|
|
|
2012-09-05 03:13:17 +00:00
|
|
|
// Populate the default shortcut set.
|
2013-12-15 09:51:10 +00:00
|
|
|
$shortcut = entity_create('shortcut', array(
|
2013-12-15 16:04:46 +00:00
|
|
|
'shortcut_set' => 'default',
|
2013-12-15 09:51:10 +00:00
|
|
|
'title' => t('Add content'),
|
2012-09-05 03:13:17 +00:00
|
|
|
'weight' => -20,
|
2013-12-15 09:51:10 +00:00
|
|
|
'path' => 'node/add',
|
2013-12-15 16:04:46 +00:00
|
|
|
'langcode' => language_default()->id,
|
2013-02-08 23:55:25 +00:00
|
|
|
));
|
2013-12-15 09:51:10 +00:00
|
|
|
$shortcut->save();
|
2013-02-08 23:55:25 +00:00
|
|
|
|
2013-12-15 09:51:10 +00:00
|
|
|
$shortcut = entity_create('shortcut', array(
|
2013-12-15 16:04:46 +00:00
|
|
|
'shortcut_set' => 'default',
|
2013-12-15 09:51:10 +00:00
|
|
|
'title' => t('All content'),
|
2012-09-05 03:13:17 +00:00
|
|
|
'weight' => -19,
|
2013-12-15 09:51:10 +00:00
|
|
|
'path' => 'admin/content',
|
2013-12-15 16:04:46 +00:00
|
|
|
'langcode' => language_default()->id,
|
2013-02-08 23:55:25 +00:00
|
|
|
));
|
2013-12-15 09:51:10 +00:00
|
|
|
$shortcut->save();
|
2012-09-05 03:13:17 +00:00
|
|
|
|
2009-08-21 07:50:08 +00:00
|
|
|
// Enable the admin theme.
|
2012-09-18 14:04:16 +00:00
|
|
|
theme_enable(array('seven'));
|
2013-09-16 03:58:06 +00:00
|
|
|
\Drupal::config('system.theme')->set('admin', 'seven')->save();
|
|
|
|
\Drupal::config('node.settings')->set('use_admin_theme', '1')->save();
|
2009-08-21 07:50:08 +00:00
|
|
|
}
|