varbase-8.x-4.0-alpha1/varbase.install
varbase.install
<?php
/**
* @file
* Install, update and uninstall functions for the Varbase installation profile.
*/
use Drupal\user\Entity\User;
use Drupal\user\RoleInterface;
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function varbase_install() {
// Set front page to "node".
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE);
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
$user->save();
// Restrict user registration to admin role creation
\Drupal::configFactory()->getEditable('user.settings')->set('register', USER_REGISTER_ADMINISTRATORS_ONLY)->save(TRUE);
// Allow authenticated users to use shortcuts.
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access shortcuts']);
// Allow all users to use search.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('search content'));
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array('search content'));
// Enable the admin theme.
\Drupal::configFactory()->getEditable('node.settings')->set('use_admin_theme', TRUE)->save(TRUE);
}
