function demo_umami_install
Same name in other branches
- 9 core/profiles/demo_umami/demo_umami.install \demo_umami_install()
- 8.9.x core/profiles/demo_umami/demo_umami.install \demo_umami_install()
- 10 core/profiles/demo_umami/demo_umami.install \demo_umami_install()
Implements hook_install().
Perform actions to set up the site for this profile.
See also
File
-
core/
profiles/ demo_umami/ demo_umami.install, line 35
Code
function demo_umami_install() : void {
// We install some menu links, so we have to rebuild the router, to ensure the
// menu links are valid.
\Drupal::service('router.builder')->rebuildIfNeeded();
// 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();
// Enable the demo content module. This can't be specified as a dependency
// in the demo_umami.info.yml file, as it requires configuration provided by
// the profile (fields etc.).
\Drupal::service('module_installer')->install([
'demo_umami_content',
], TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.