<div style="">
<table class="settingsTable">
<tbody>
+ <?php if ($model->cms !== 'Standalone'): ?>
<tr>
<th><?php echo ts('CMS Database'); ?></th>
<td>
</div>
</td>
</tr>
+ <?php endif; ?>
<tr>
<th><?php echo ts('CiviCRM Settings File'); ?></th>
<td><code><?php echo htmlentities($model->settingsPath); ?></code></td>
--- /dev/null
+<?php
+if (!defined('CIVI_SETUP')) {
+ exit("Installation plugins must only be loaded by the installer.\n");
+}
+
+\Civi\Setup::dispatcher()
+ ->addListener('civi.setupui.boot', function (\Civi\Setup\UI\Event\UIBootEvent $e) {
+ \Civi\Setup::log()->info(sprintf('[%s] Register blocks', basename(__FILE__)));
+
+ /**
+ * @var \Civi\Setup\UI\SetupController $ctrl
+ */
+ $ctrl = $e->getCtrl();
+
+ $ctrl->blocks['database'] = [
+ 'is_active' => ($e->getModel()->cms === 'Standalone'),
+ 'file' => __DIR__ . DIRECTORY_SEPARATOR . 'database.tpl.php',
+ 'class' => '',
+ 'weight' => 15,
+ ];
+ if (empty($ctrl->blocks['database']['is_active'])) {
+ return;
+ }
+
+ $webDefault = ['server' => '127.0.0.1:3306', 'database' => 'civicrm', 'username' => '', 'password' => ''];
+
+ if ($e->getMethod() === 'GET') {
+ $e->getModel()->db = $webDefault;
+ }
+ elseif ($e->getMethod() === 'POST') {
+ $db = $e->getField('db', $webDefault);
+
+ foreach (['server', 'database', 'username', 'password'] as $field) {
+ $e->getModel()->db[$field] = $db[$field];
+ }
+ }
+
+ }, \Civi\Setup::PRIORITY_PREPARE);
--- /dev/null
+<?php if (!defined('CIVI_SETUP')): exit("Installation plugins must only be loaded by the installer.\n");
+endif; ?>
+
+<h2><?php echo ts('Database'); ?></h2>
+
+<p style="margin-left: 2em">
+ <label for="server"><span><?php echo ts('Server:'); ?></span></label>
+ <input type="text" id="dbServer" name="civisetup[db][server]" value="<?php echo htmlentities($model->db['server'] ?? '') ?>">
+</p>
+
+<p style="margin-left: 2em">
+ <label for="database"><span><?php echo ts('Database:'); ?></span></label>
+ <input type="text" id="dbDatabase" name="civisetup[db][database]" value="<?php echo htmlentities($model->db['database'] ?? '') ?>">
+</p>
+
+<p style="margin-left: 2em">
+ <label for="username"><span><?php echo ts('Username:'); ?></span></label>
+ <input type="text" id="dbUsername" name="civisetup[db][username]" value="<?php echo htmlentities($model->db['username'] ?? '') ?>">
+</p>
+
+<p style="margin-left: 2em">
+ <label for="password"><span><?php echo ts('Password:'); ?></span></label>
+ <input type="password" id="dbPassword" name="civisetup[db][password]" value="<?php echo htmlentities($model->db['password'] ?? '') ?>">
+</p>