From a03f0e58066755550e4744a793c2926a9c9744d1 Mon Sep 17 00:00:00 2001 From: Jacine Luisi Date: Thu, 11 Jul 2019 11:01:39 -0400 Subject: [PATCH 1/2] #72: Always install demo content. --- apigee_devportal_kickstart.profile | 15 ++- src/Installer/Form/DemoInstallForm.php | 125 ------------------------- 2 files changed, 10 insertions(+), 130 deletions(-) delete mode 100644 src/Installer/Form/DemoInstallForm.php diff --git a/apigee_devportal_kickstart.profile b/apigee_devportal_kickstart.profile index e29e8b4d..8185429b 100644 --- a/apigee_devportal_kickstart.profile +++ b/apigee_devportal_kickstart.profile @@ -37,12 +37,7 @@ use Drupal\Core\Messenger\MessengerInterface; */ function apigee_devportal_kickstart_install_tasks(&$install_state) { $tasks = [ - DemoInstallForm::class => [ - 'display_name' => t('Install demo content'), - 'type' => 'form', - ], 'apigee_devportal_kickstart_theme_setup' => [ - 'display_name' => t('Install theme'), 'display' => FALSE, ], ]; @@ -178,6 +173,16 @@ function apigee_devportal_kickstart_theme_setup(array &$install_state) { ->getEditable('node.settings') ->set('use_admin_theme', TRUE) ->save(TRUE); + + // Install demo content. + \Drupal::service('module_installer') + ->install(['apigee_kickstart_content']); + + // Set the front page to node 1. + \Drupal::configFactory() + ->getEditable('system.site') + ->set('page.front', '/node/1') + ->save(); } /** diff --git a/src/Installer/Form/DemoInstallForm.php b/src/Installer/Form/DemoInstallForm.php deleted file mode 100644 index d82b797c..00000000 --- a/src/Installer/Form/DemoInstallForm.php +++ /dev/null @@ -1,125 +0,0 @@ -moduleInstaller = $module_installer; - $this->configFactory = $config_factory; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('module_installer'), - $container->get('config.factory') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'apigee_devportal_kickstart_demo_install_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $form['#title'] = $this->t('Install Demo content?'); - - $form['install_demo_content'] = [ - '#type' => 'checkbox', - '#title' => 'Enable demo content', - '#description' => $this->t('Check this box to install some demo content to help you test out Apigee portal features quickly.'), - '#default_value' => TRUE, - ]; - - $form['actions']['#type'] = 'actions'; - - $form['actions']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save and continue'), - '#button_type' => 'primary', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $demo_content = $form_state->getValue('install_demo_content'); - - // We have to use getUserInput() to supersede getValue() because that isn't - // correctly set when passing the form value to Drush si like: - // "drush si apigee_kickstart apigee_devportal_kickstart_demo_install_form.install_demo_content=0". - $input = $form_state->getUserInput(); - if (isset($input['install_demo_content'])) { - $demo_content = !empty($input['install_demo_content']); - } - - if ($demo_content) { - $this->moduleInstaller->install(['apigee_kickstart_content']); - - // Set the front page to node 1. - $this->configFactory->getEditable('system.site') - ->set('page.front', '/node/1') - ->save(); - } - } - -} From cad1c32087ae94ab29935738edeeed0584699a99 Mon Sep 17 00:00:00 2001 From: Jacine Luisi Date: Thu, 11 Jul 2019 11:05:50 -0400 Subject: [PATCH 2/2] #72: Remove demo content known issue. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2667eb39..e0add2f3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ our [Github issue queue](https://github.com/apigee/apigee-devportal-kickstart-dr ## Known issues * Using `drush si` to install the site with Apigee Edge credentials is not working. See [#109](https://github.com/apigee/apigee-devportal-kickstart-drupal/issues/109) for details. -* When "Enable demo content" is not selected during installation, associated custom blocks are still placed. See [#72](https://github.com/apigee/apigee-devportal-kickstart-drupal/issues/72) for details. ## Contribute