Closed finnlewis closed 2 years ago
Realised that we're creating a new editorial workflow rather than loading the existing one if it already exists. Latest commit tries to load the existing editorial workflow configuration, if it already exists.
So the issue is that install order can't be guaranteed when using config-import? So hook_install is run before the workflow config is installed. So the advice is not to rely on other configuration in an install hook.
The only other alternative would be to put it somewhere guaranteed to be at the end of the install process? But there's no equivalent to post_update. hook_requirements runtime would check too often.
So wracking brain can't think of something better...? Is hook_modules_installed late enough? Or could the config still not be there?
Add check in hook_install to load the editorial workflow directly from config/install if not present. This is to accommodate for installing via drush config-import where sometimes the hook_install is run before the workflow configuration is loaded. See https://github.com/localgovdrupal/localgov_workflows/issues/2 and https://www.drupal.org/project/drupal/issues/2906107