Skip to content
Snippets Groups Projects

Corrections and improvements in the construction of the migration configuration forms.

2 files
+ 40
42
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -58,33 +58,32 @@ class CreateMWDatabase extends ConfigFormBase {
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$database_fields = [
$this->t('id'),
$this->t('migration_group'),
$this->t('key'),
$this->t('target'),
$this->t('host'),
$this->t('database'),
$this->t('username'),
$this->t('password'),
$this->t('prefix'),
$this->t('driver'),
$this->t('port'),
$this->t('namespace'),
$this->t('collation'),
$this->t('url_files_prod'),
'id' =>$this->t('Migration ID'),
'migration_group' => $this->t('Migration group'),
'key' => $this->t('Key'),
'target' => $this->t('Target'),
'host' => $this->t('Database host'),
'database' => $this->t('Database name'),
'username' => $this->t('Database username'),
'password' => $this->t('Database password'),
'prefix' => $this->t('Database prefix'),
'driver' => $this->t('Database driver'),
'port' => $this->t('Database port'),
'namespace' => $this->t('Database driver namespace'),
'collation' => $this->t('Database collation'),
'url_files_prod' => $this->t('Production URL'),
];
$use_envs = ['host', 'database', 'username', 'password'];
$use_envs = ['key', 'target', 'host', 'database', 'username', 'password'];
$form['use_env'] = [
'#type' => 'checkbox',
'#title' => $this->t('Use .env *'),
];
foreach ($database_fields as $database_field) {
$database_field = $database_field->render();
foreach ($database_fields as $key => $database_field) {
$title = $database_field;
if (in_array($database_field, $use_envs)) {
if (in_array($key, $use_envs)) {
$title = $title . ' *';
}
$form[$database_field] = [
$form[$key] = [
'#type' => 'textfield',
'#title' => $title,
'#size' => '20',
Loading