diff --git a/recipes/acquia_drupal_starterkit_content_model/recipe.yml b/recipes/acquia_drupal_starterkit_content_model/recipe.yml index fe6ce4804..cddb9c74f 100644 --- a/recipes/acquia_drupal_starterkit_content_model/recipe.yml +++ b/recipes/acquia_drupal_starterkit_content_model/recipe.yml @@ -1,4 +1,4 @@ -name: 'Acquia Drupal Startekit Low-Code' +name: 'Acquia Drupal Startekit Content Model' description: 'An content model provides Article, Event, Page, Person, Place content types.' type: 'Starterkit' recipes: diff --git a/recipes/acquia_drupal_starterkit_headless/recipe.yml b/recipes/acquia_drupal_starterkit_headless/recipe.yml index 269922b9a..8cd78a41a 100644 --- a/recipes/acquia_drupal_starterkit_headless/recipe.yml +++ b/recipes/acquia_drupal_starterkit_headless/recipe.yml @@ -6,3 +6,13 @@ recipes: install: # Contrib - acquia_cms_headless +config: + actions: + project_browser.admin_settings: + simple_config_update: + allowed_projects: + recipes: + - acquia_drupal_starterkit_community + - acquia_drupal_starterkit_content_model + - acquia_drupal_starterkit_headless + - acquia_drupal_starterkit_media_model diff --git a/recipes/acquia_drupal_starterkit_installer/acquia_drupal_starterkit_installer.profile b/recipes/acquia_drupal_starterkit_installer/acquia_drupal_starterkit_installer.profile index be3dccb9b..ad5155631 100644 --- a/recipes/acquia_drupal_starterkit_installer/acquia_drupal_starterkit_installer.profile +++ b/recipes/acquia_drupal_starterkit_installer/acquia_drupal_starterkit_installer.profile @@ -9,7 +9,8 @@ use Drupal\Core\Installer\Form\SiteConfigureForm; use Drupal\Core\Installer\Form\SiteSettingsForm; use Drupal\Core\Recipe\Recipe; use Drupal\Core\Recipe\RecipeRunner; -use Drupal\acquia_drupal_starterkit_installer\Form\RecipesForm; +use Drupal\acquia_drupal_starterkit_installer\Form\RecipesStarterkitForm; +use Drupal\acquia_drupal_starterkit_installer\Form\RecipesAddOnForm; use Drupal\acquia_drupal_starterkit_installer\Form\SiteNameForm; /** @@ -46,12 +47,19 @@ function acquia_drupal_starterkit_installer_install_tasks_alter(array &$tasks, a $tasks_after = array_slice($tasks, $key, NULL, TRUE); $tasks = $tasks_before + $additions + $tasks_after; }; + $insert_before('install_settings_form', [ 'acquia_drupal_starterkit_installer_choose_recipes' => [ 'display_name' => t('Choose add-ons'), 'type' => 'form', 'run' => array_key_exists('recipes', $install_state['parameters']) ? INSTALL_TASK_SKIP : INSTALL_TASK_RUN_IF_REACHED, - 'function' => RecipesForm::class, + 'function' => RecipesStarterkitForm::class, + ], + 'acquia_drupal_starterkit_installer_addons' => [ + 'display_name' => t('Extend Acquia Drupal Starter Kit with Add-ons'), + 'type' => 'form', + 'run' => array_key_exists('recipes_starterkit_addons', $install_state['parameters']) ? INSTALL_TASK_SKIP : INSTALL_TASK_RUN_IF_REACHED, + 'function' => RecipesAddOnForm::class, ], 'acquia_drupal_starterkit_installer_site_name_form' => [ 'display_name' => t('Name your site'), diff --git a/recipes/acquia_drupal_starterkit_installer/css/add-ons.css b/recipes/acquia_drupal_starterkit_installer/css/add-ons.css index a966205e2..ed13271b6 100644 --- a/recipes/acquia_drupal_starterkit_installer/css/add-ons.css +++ b/recipes/acquia_drupal_starterkit_installer/css/add-ons.css @@ -18,6 +18,15 @@ word-wrap: normal; } +#edit-add-ons [type="radio"] { + position: absolute; + overflow: hidden; + clip: rect(1px, 1px, 1px, 1px); + width: 1px; + height: 1px; + word-wrap: normal; +} + #edit-add-ons label { display: inline-block; color: #39353e; diff --git a/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesAddOnForm.php b/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesAddOnForm.php new file mode 100644 index 000000000..2fd25c284 --- /dev/null +++ b/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesAddOnForm.php @@ -0,0 +1,78 @@ +t('Extend Acquia Drupal Starter Kit with Add-ons'); + + $form['help'] = [ + '#prefix' => '

', + '#markup' => $this->t('You can change your mind later.'), + '#suffix' => '

', + ]; + $options = [ + 'acquia_drupal_starterkit_content_model' => $this->t('Acquia Drupal Starterkit Content Model'), + 'acquia_drupal_starterkit_media_model' => $this->t('Acquia Drupal Starterkit Media Model'), + ]; + + $form['add_ons'] = [ + '#prefix' => '
', + '#suffix' => '
', + '#type' => 'checkboxes', + '#options' => $options, + '#default_value' => [], + ]; + $form['actions'] = [ + 'submit' => [ + '#type' => 'submit', + '#value' => $this->t('Next'), + '#button_type' => 'primary', + ], + 'skip' => [ + '#type' => 'submit', + '#value' => $this->t('Skip this step'), + ], + '#type' => 'actions', + ]; + return parent::buildForm($form, $form_state); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state): void { + global $install_state; + $install_state['parameters']['recipes'] = $this->getRequest()->get('recipes') ?? []; + $install_state['parameters']['recipes_starterkit_addons'] = $install_state['parameters']['recipes']; + $pressed_button = $form_state->getTriggeringElement(); + // Only choose add-ons if the Next button was pressed. + if ($pressed_button && end($pressed_button['#array_parents']) === 'submit') { + $add_ons = $form_state->getValue('add_ons', []); + $add_ons = array_filter($add_ons); + array_push($install_state['parameters']['recipes'], ...array_values($add_ons)); + array_push($install_state['parameters']['recipes_starterkit_addons'], ...array_values($add_ons)); + } + + } + +} diff --git a/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesForm.php b/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesStarterkitForm.php similarity index 81% rename from recipes/acquia_drupal_starterkit_installer/src/Form/RecipesForm.php rename to recipes/acquia_drupal_starterkit_installer/src/Form/RecipesStarterkitForm.php index d6186ff0d..51d144d1d 100644 --- a/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesForm.php +++ b/recipes/acquia_drupal_starterkit_installer/src/Form/RecipesStarterkitForm.php @@ -10,7 +10,7 @@ * @todo Present this as a mini project browser once * https://www.drupal.org/i/3450629 is fixed. */ -final class RecipesForm extends InstallerFormBase { +final class RecipesStarterkitForm extends InstallerFormBase { /** * {@inheritdoc} @@ -35,17 +35,16 @@ public function buildForm(array $form, FormStateInterface $form_state): array { 'acquia_drupal_starterkit_community' => $this->t('Acquia Drupal Starterkit Community'), 'acquia_drupal_starterkit_headless' => $this->t('Acquia Drupal Starterkit Headless'), 'acquia_drupal_starterkit_low_code' => $this->t('Acquia Drupal Starterkit Low-Code'), - 'acquia_drupal_starterkit_content_model' => $this->t('Acquia Drupal Starterkit Content Model'), - 'acquia_drupal_starterkit_media_model' => $this->t('Acquia Drupal Starterkit Media Model'), ]; $form['add_ons'] = [ '#prefix' => '
', '#suffix' => '
', - '#type' => 'checkboxes', + '#type' => 'radios', '#options' => $options, '#default_value' => [], ]; + $form['actions'] = [ 'submit' => [ '#type' => 'submit', @@ -67,13 +66,13 @@ public function buildForm(array $form, FormStateInterface $form_state): array { public function submitForm(array &$form, FormStateInterface $form_state): void { global $install_state; $install_state['parameters']['recipes'] = ['acquia_drupal_starterkit']; - $pressed_button = $form_state->getTriggeringElement(); // Only choose add-ons if the Next button was pressed. if ($pressed_button && end($pressed_button['#array_parents']) === 'submit') { - $add_ons = $form_state->getValue('add_ons', []); - $add_ons = array_filter($add_ons); - array_push($install_state['parameters']['recipes'], ...array_values($add_ons)); + $add_ons = $form_state->getValue('add_ons'); + if ($add_ons) { + $install_state['parameters']['recipes'][] = $add_ons; + } } } diff --git a/recipes/acquia_drupal_starterkit_low_code/recipe.yml b/recipes/acquia_drupal_starterkit_low_code/recipe.yml index 6fd66d065..a3a194738 100644 --- a/recipes/acquia_drupal_starterkit_low_code/recipe.yml +++ b/recipes/acquia_drupal_starterkit_low_code/recipe.yml @@ -6,3 +6,13 @@ recipes: install: # Contrib - acquia_cms_site_studio +config: + actions: + project_browser.admin_settings: + simple_config_update: + allowed_projects: + recipes: + - acquia_drupal_starterkit_community + - acquia_drupal_starterkit_content_model + - acquia_drupal_starterkit_low_code + - acquia_drupal_starterkit_media_model