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