Open finnlewis opened 1 year ago
Hmm, those install hook is sort of important though if your doing a new install, as it sets up the administrator role and removes the /node view. Maybe look at hook_install_tasks instead and detect if this is a config install?
Alterantivly, BHCC has a starter profile based on localgov that has additional config placed in config/install, or even just a minimal profile.
Thanks @andybroomfield . Would moving the tasks from hook _install in the profile to a hook_install in localgov_core make any material difference to an initial install?
@andybroomfield I'm just trying this on a branch and will send you a pull request.
The thing is that localgov_core is for supporting code for modules, but you could install that at any time so adding the set up there would cause issues as it will alter your current configuration (maybe you already have an admin role, or set a default home page). The profile hook_install is only run once, and these are very specific to those using the profile, so I don't think moving these tasks to localgov_core would appropriate. If we want to support config install then try to move to hook_install_tasks.
Ah, I see. Good points! I'll take a look at hook_install_tasks to see if that can swap in.
I've always just used a patch from https://www.drupal.org/project/drupal/issues/2982052 to get around this.
Working with Greenwich, there is a desire to run a site-install directly from existing configuration, rather than starting with a database where LocalGov Drupal has been installed, then importing configuration.
This seems to pose a problem for sites installed from a profile that has hook_install.
There is a long ongoing issue for this on Drupal.org, see https://www.drupal.org/project/drupal/issues/2982052
Looking at our hook_install, it strikes me that we don't have much in there:
https://github.com/localgovdrupal/localgov/blob/2.x/localgov.install#L18-L36
What is in there could probably be moved to one of our dependent modules, like localgov_core.
This could help support Greenwich and other councils that want to do a fresh install on a site from existing configuration.
One motivation for this is to run automated tests against a fresh copy of your production site, without the content and users.
CC @stephen-cox @ekes @Adnan-cds @andybroomfield