function user_install
Same name in other branches
- 7.x modules/user/user.install \user_install()
- 9 core/modules/user/user.install \user_install()
- 8.9.x core/modules/user/user.install \user_install()
- 11.x core/modules/user/user.install \user_install()
Implements hook_install().
4 calls to user_install()
- MigrateUserAdminPassTest::setUp in core/
modules/ user/ tests/ src/ Kernel/ Migrate/ MigrateUserAdminPassTest.php - MigrateUserTest::setUp in core/
modules/ user/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUserTest.php - UserAnonymousActivateTest::setUp in core/
modules/ user/ tests/ src/ Kernel/ UserAnonymousActivateTest.php - UserInstallTest::setUp in core/
modules/ user/ tests/ src/ Kernel/ UserInstallTest.php
File
-
core/
modules/ user/ user.install, line 73
Code
function user_install() {
$storage = \Drupal::entityTypeManager()->getStorage('user');
// Insert a row for the anonymous user.
$storage->create([
'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([
'uid' => 1,
'name' => 'placeholder-for-uid-1',
'mail' => 'placeholder-for-uid-1',
'status' => TRUE,
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.