"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/profiles/standard/standard.install" (26 Nov 2020, 1055 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "standard.install": 9.0.8_vs_9.1.0-rc1.

    1 <?php
    2 
    3 /**
    4  * @file
    5  * Install, update and uninstall functions for the standard installation profile.
    6  */
    7 
    8 use Drupal\user\Entity\User;
    9 use Drupal\shortcut\Entity\Shortcut;
   10 
   11 /**
   12  * Implements hook_install().
   13  *
   14  * Perform actions to set up the site for this profile.
   15  *
   16  * @see system_install()
   17  */
   18 function standard_install() {
   19   // Assign user 1 the "administrator" role.
   20   $user = User::load(1);
   21   $user->roles[] = 'administrator';
   22   $user->save();
   23 
   24   // We install some menu links, so we have to rebuild the router, to ensure the
   25   // menu links are valid.
   26   \Drupal::service('router.builder')->rebuildIfNeeded();
   27 
   28   // Populate the default shortcut set.
   29   $shortcut = Shortcut::create([
   30     'shortcut_set' => 'default',
   31     'title' => t('Add content'),
   32     'weight' => -20,
   33     'link' => ['uri' => 'internal:/node/add'],
   34   ]);
   35   $shortcut->save();
   36 
   37   $shortcut = Shortcut::create([
   38     'shortcut_set' => 'default',
   39     'title' => t('All content'),
   40     'weight' => -19,
   41     'link' => ['uri' => 'internal:/admin/content'],
   42   ]);
   43   $shortcut->save();
   44 }