social.install in Open Social 8
Install, update and uninstall functions for the social installation profile.
File
social.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the social installation profile.
*/
use Drupal\user\Entity\User;
use Drupal\user\Entity\Role;
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function social_install() {
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/stream')
->save(TRUE);
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
$user
->save();
// Create the content manager role.
$data = [
'id' => 'contentmanager',
'label' => 'Content manager',
];
$role = Role::create($data);
$role
->save();
// Create the site manager role.
$data = [
'id' => 'sitemanager',
'label' => 'Site manager',
];
$role = Role::create($data);
$role
->save();
}
Functions
Name![]() |
Description |
---|---|
social_install | Implements hook_install(). |