Browse Source

Set default settings (#138)

pull/729/head
Jared Whiklo 6 years ago committed by dannylamb
parent
commit
a6c89adbbe
  1. 4
      config/install/islandora.settings.yml
  2. 2
      islandora.module
  3. 8
      src/Form/IslandoraSettingsForm.php

4
config/install/islandora.settings.yml

@ -0,0 +1,4 @@
broker_url: 'tcp://localhost:61613'
jwt_expiry: '+2 hour'
gemini_url: ''
gemini_pseudo_bundles: []

2
islandora.module

@ -356,7 +356,7 @@ function islandora_entity_extra_field_info() {
$config_factory = \Drupal::service('config.factory')->get(IslandoraSettingsForm::CONFIG_NAME); $config_factory = \Drupal::service('config.factory')->get(IslandoraSettingsForm::CONFIG_NAME);
$extra_field = []; $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) { foreach ($pseudo_bundles as $key) {
list($bundle, $content_entity) = explode(":", $key); list($bundle, $content_entity) = explode(":", $key);

8
src/Form/IslandoraSettingsForm.php

@ -80,22 +80,22 @@ class IslandoraSettingsForm extends ConfigFormBase {
$form[self::BROKER_URL] = [ $form[self::BROKER_URL] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Broker URL'), '#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] = [ $form[self::JWT_EXPIRY] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('JWT Expiry'), '#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] = [ $form[self::GEMINI_URL] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Gemini URL'), '#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 = []; $options = [];
foreach (['node', 'media', 'taxonomy_term'] as $content_entity) { foreach (['node', 'media', 'taxonomy_term'] as $content_entity) {

Loading…
Cancel
Save