This is the equivalent of https://www.drupal.org/project/drupal/issues/2924549

Description of the need

Currently, there is no way for modules to respond to a Backdrop site being installed. Modules can implement hook_modules_installed() to check if a profile has been installed, but there are many site install tasks that happen after that - specifically optional configuration is installed and the default theme is changed. It would be nice if there was a more explicit hook that ran as the last site install task, so that modules could execute code at the very end of the install process.

Possible implementations of this hook:

  • Enable an optional module feature if a specific profile is installed.
  • Show a status message to the user once the install is finished.
  • Act on optional config installed at the end of the profile installation process. This is really hard to do without this hook.

Proposed solution

Add a new hook, hook_site_install_finished(), which allows modules to respond to a Backdrop site install. Modules are also provided the $install_state, which has useful contextual data about the install like the profile and whether or not the install was interactive.

Additional information

The original PR that got merged for #5624 added the welcome message to core/includes/install.core.inc, which meant that the message was only shown to user1 (the user that performs the site installation). It also required a check for whether the Dashboard module is installed.

I have proposed an alternative PR, which allows showing a welcome message to help people like content authors that log into the site find the Dashboard. The message is shown only the first time each user logs into the site, and only if the "Redirect administrators to Dashboard after log in" setting provided by the Dashboard module in admin/dashboard/settings is disabled.

This message makes more sense to be provided by the Dashboard module, and it is more helpful if not only shown to user1 after the site is installed. However, adding the message to dashboard_user_login() makes it so that it is NOT shown to user1 after installation. Now, although this alternative implementation serves multiple people in various use cases (instead of being limited to user1 and only after the initial site installation), this thought trail is based on the assumption that most people installing Backdrop won't need to be told where the Dashboard lives - they'd either already know about it, or they'd be able to find it in the admin bar. But that assumes seasoned Drupal/Backdrop users, which may not always be the case. If we added this feature here, we'd be allowing the Dashboard module (as well as other contrib/custom modules and potentially also themes when #4829 gets implemented) to react to the completion of the site installation as well, and we'd have a way to show the message to both use1 as well as other "regular" users, and it would all live in the Dashboard module, as it should be.

...also, feature parity with D10

GitHub Issue #: 
5876