From a6c89adbbe5b09b2f22a39c12ca27d8da1b78240 Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Tue, 28 May 2019 20:41:22 -0500 Subject: [PATCH] Set default settings (#138) --- config/install/islandora.settings.yml | 4 ++++ islandora.module | 2 +- src/Form/IslandoraSettingsForm.php | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 config/install/islandora.settings.yml diff --git a/config/install/islandora.settings.yml b/config/install/islandora.settings.yml new file mode 100644 index 00000000..8fb25fb8 --- /dev/null +++ b/config/install/islandora.settings.yml @@ -0,0 +1,4 @@ +broker_url: 'tcp://localhost:61613' +jwt_expiry: '+2 hour' +gemini_url: '' +gemini_pseudo_bundles: [] diff --git a/islandora.module b/islandora.module index 6a1f251c..8b0d52e1 100644 --- a/islandora.module +++ b/islandora.module @@ -356,7 +356,7 @@ function islandora_entity_extra_field_info() { $config_factory = \Drupal::service('config.factory')->get(IslandoraSettingsForm::CONFIG_NAME); $extra_field = []; - $pseudo_bundles = $config_factory->get(IslandoraSettingsForm::GEMINI_PSEUDO) ? $config_factory->get(IslandoraSettingsForm::GEMINI_PSEUDO) : []; + $pseudo_bundles = $config_factory->get(IslandoraSettingsForm::GEMINI_PSEUDO); foreach ($pseudo_bundles as $key) { list($bundle, $content_entity) = explode(":", $key); diff --git a/src/Form/IslandoraSettingsForm.php b/src/Form/IslandoraSettingsForm.php index 6ec80165..8079279d 100644 --- a/src/Form/IslandoraSettingsForm.php +++ b/src/Form/IslandoraSettingsForm.php @@ -80,22 +80,22 @@ class IslandoraSettingsForm extends ConfigFormBase { $form[self::BROKER_URL] = [ '#type' => 'textfield', '#title' => $this->t('Broker URL'), - '#default_value' => $config->get(self::BROKER_URL) ? $config->get(self::BROKER_URL) : 'tcp://localhost:61613', + '#default_value' => $config->get(self::BROKER_URL), ]; $form[self::JWT_EXPIRY] = [ '#type' => 'textfield', '#title' => $this->t('JWT Expiry'), - '#default_value' => $config->get(self::JWT_EXPIRY) ? $config->get(self::JWT_EXPIRY) : '+2 hour', + '#default_value' => $config->get(self::JWT_EXPIRY), ]; $form[self::GEMINI_URL] = [ '#type' => 'textfield', '#title' => $this->t('Gemini URL'), - '#default_value' => $config->get(self::GEMINI_URL) ? $config->get(self::GEMINI_URL) : '', + '#default_value' => $config->get(self::GEMINI_URL), ]; - $selected_bundles = $config->get(self::GEMINI_PSEUDO) ? $config->get(self::GEMINI_PSEUDO) : []; + $selected_bundles = $config->get(self::GEMINI_PSEUDO); $options = []; foreach (['node', 'media', 'taxonomy_term'] as $content_entity) {