Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. user.install

function user_install

Implements hook_install().

File

core/modules/user/user.install, line 71

Code

function user_install() : void {
    $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();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal