user_install

user_install()

Implements hook_install().

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();
}
doc_Drupal
2016-10-29 09:53:15
Comments
Leave a Comment

Please login to continue.