pino-8.x-1.2-no-core/pino.install
pino.install
<?php
/**
* @file
* Install, update and uninstall functions for the pino installation profile.
*/
use Drupal\user\Entity\User;
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function pino_install() {
// Set front page to newest members.
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/latest')->save(TRUE);
// Allow only administrators to create accounts.
$user_settings = \Drupal::configFactory()->getEditable('user.settings');
$user_settings->set('register', USER_REGISTER_ADMINISTRATORS_ONLY)->save(TRUE);
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
$user->save();
// Clear all caches.
drupal_flush_all_caches();
}
