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
|
|
|
|
2014-03-10 12:25:21 +00:00
|
|
|
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
|
|
|
|
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() {
|
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.
|
2014-03-10 12:25:21 +00:00
|
|
|
\Drupal::service('comment.manager')->addDefaultField('node', 'article', 'comment', CommentItemInterface::OPEN);
|
2014-06-26 02:13:06 +00:00
|
|
|
|
|
|
|
// Hide the comment field in the rss view mode.
|
|
|
|
entity_get_display('node', 'article', 'rss')
|
|
|
|
->removeComponent('comment')
|
|
|
|
->save();
|
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.
|
2014-02-13 11:28:24 +00:00
|
|
|
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
|
|
|
|
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('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.
|
2014-08-27 08:05:25 +00:00
|
|
|
user_role_grant_permissions('administrator', array_keys(\Drupal::service('user.permissions')->getPermissions()));
|
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();
|
|
|
|
|
2014-07-30 12:02:58 +00:00
|
|
|
// Enable the Contact link in the footer menu.
|
2014-07-30 12:04:04 +00:00
|
|
|
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
|
|
|
|
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
|
2014-08-12 19:30:35 +00:00
|
|
|
$menu_link_manager->updateDefinition('contact.site_page', array('enabled' => 1));
|
2014-07-30 12:04:04 +00:00
|
|
|
|
2012-11-20 11:36:51 +00:00
|
|
|
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'));
|
|
|
|
|
2014-06-09 23:13:41 +00:00
|
|
|
// Allow authenticated users to use shortcuts.
|
|
|
|
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access shortcuts'));
|
|
|
|
|
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-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-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.
|
2013-09-16 03:58:06 +00:00
|
|
|
\Drupal::config('node.settings')->set('use_admin_theme', '1')->save();
|
2009-08-21 07:50:08 +00:00
|
|
|
}
|