3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Install modules from the farm_install_modules.modules install state if provided.

This commit is contained in:
paul121 2021-02-25 17:05:25 -08:00 committed by Michael Stenta
parent 1f3273a7eb
commit 888775332f

View file

@ -5,6 +5,8 @@
* Install, update and uninstall functions for the farmOS installation profile.
*/
use Drupal\Component\Serialization\Json;
/**
* Implements hook_install_tasks().
*/
@ -51,9 +53,17 @@ function farm_install_tasks_alter(&$tasks, $install_state) {
*/
function farm_install_modules(array &$install_state) {
// Load the list of modules that should be installed. This state is set by
// the \Drupal\farm\Form\FarmModulesForm submit method.
$modules = \Drupal::state()->get('farm.install_modules') ?: [];
// Load the list of modules that should be installed.
// If provided, use the modules defined in farm_install_modules.module
// profile arguments.
if (!empty($install_state['forms']['farm_install_modules']['modules'])) {
$modules = Json::decode($install_state['forms']['farm_install_modules']['modules']);
}
// Use the state set by the \Drupal\farm\Form\FarmModulesForm submit method.
else {
$modules = \Drupal::state()->get('farm.install_modules') ?: [];
}
// If this is running in the context of a functional test, do not install any
// additional modules. This is a temporary hack.