You are here

function user_install in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/user.install \user_install()

Implements hook_install().

3 calls to user_install()
MigrateUserAdminPassTest::setUp in core/modules/user/src/Tests/Migrate/MigrateUserAdminPassTest.php
Performs setup tasks before each individual test method is run.
MigrateUserTest::setUp in core/modules/user/src/Tests/Migrate/d6/MigrateUserTest.php
Performs setup tasks before each individual test method is run.
UserInstallTest::setUp in core/modules/user/src/Tests/UserInstallTest.php
Performs setup tasks before each individual test method is run.

File

core/modules/user/user.install, line 66
Install, update and uninstall functions for the user module.

Code

function user_install() {
  $storage = \Drupal::entityManager()
    ->getStorage('user');

  // Insert a row for the anonymous user.
  $storage
    ->create(array(
    'uid' => 0,
    'status' => 0,
    'name' => '',
  ))
    ->save();

  // We need some placeholders here as name and mail are unique.
  // This will be changed by the settings form in the installer.
  $storage
    ->create(array(
    'uid' => 1,
    'name' => 'placeholder-for-uid-1',
    'mail' => 'placeholder-for-uid-1',
    'status' => TRUE,
  ))
    ->save();
}