You are here

function standard_install in Drupal 10

Same name and namespace in other branches
  1. 8 core/profiles/standard/standard.install \standard_install()
  2. 7 profiles/standard/standard.install \standard_install()
  3. 9 core/profiles/standard/standard.install \standard_install()

Implements hook_install().

Perform actions to set up the site for this profile.

See also

system_install()

File

core/profiles/standard/standard.install, line 18
Install, update and uninstall functions for the standard installation profile.

Code

function standard_install() {

  // Assign user 1 the "administrator" role.

  /** @var \Drupal\user\Entity\User $user */
  $user = User::load(1);
  $user
    ->addRole('administrator');
  $user
    ->save();

  // Populate the default shortcut set.
  $shortcut = Shortcut::create([
    'shortcut_set' => 'default',
    'title' => t('Add content'),
    'weight' => -20,
    'link' => [
      'uri' => 'internal:/node/add',
    ],
  ]);
  $shortcut
    ->save();
  $shortcut = Shortcut::create([
    'shortcut_set' => 'default',
    'title' => t('All content'),
    'weight' => -19,
    'link' => [
      'uri' => 'internal:/admin/content',
    ],
  ]);
  $shortcut
    ->save();
}