From 63a035fd9197266a68c614b388372598635f75bc Mon Sep 17 00:00:00 2001 From: Natkeeran Date: Wed, 11 Dec 2019 12:30:49 -0500 Subject: [PATCH] Fedora url (#742) * fedora url * save the config value * form validation for fedora url * get fedora_url from default settings.php * travis syntax cleanup --- src/EventGenerator/EventGenerator.php | 5 +++++ src/Form/IslandoraSettingsForm.php | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/EventGenerator/EventGenerator.php b/src/EventGenerator/EventGenerator.php index 8b8da0ca..3175c224 100644 --- a/src/EventGenerator/EventGenerator.php +++ b/src/EventGenerator/EventGenerator.php @@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\islandora\IslandoraUtils; use Drupal\islandora\MediaSource\MediaSourceService; use Drupal\user\UserInterface; +use Drupal\Core\Site\Settings; use Drupal\media\Entity\Media; use Drupal\Core\Entity\EntityStorageInterface; @@ -90,6 +91,10 @@ class EventGenerator implements EventGeneratorInterface { ], ]; + $flysystem_config = Settings::get('flysystem'); + $fedora_url = $flysystem_config['fedora']['config']['root']; + $event["target"] = $fedora_url; + $entity_type = $entity->getEntityTypeId(); $event_type = $data["event"]; if ($data["event"] == "Generate Derivative") { diff --git a/src/Form/IslandoraSettingsForm.php b/src/Form/IslandoraSettingsForm.php index f71cb93c..ea2fad30 100644 --- a/src/Form/IslandoraSettingsForm.php +++ b/src/Form/IslandoraSettingsForm.php @@ -6,6 +6,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityTypeBundleInfo; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Site\Settings; use Drupal\Core\Url; use GuzzleHttp\Exception\ConnectException; use Islandora\Crayfish\Commons\Client\GeminiClient; @@ -24,6 +25,7 @@ class IslandoraSettingsForm extends ConfigFormBase { const JWT_EXPIRY = 'jwt_expiry'; const GEMINI_URL = 'gemini_url'; const GEMINI_PSEUDO = 'gemini_pseudo_bundles'; + const FEDORA_URL = 'fedora_url'; /** * To list the available bundle types. @@ -96,6 +98,16 @@ class IslandoraSettingsForm extends ConfigFormBase { '#default_value' => $config->get(self::GEMINI_URL), ]; + $flysystem_config = Settings::get('flysystem'); + $fedora_url = $flysystem_config['fedora']['config']['root']; + + $form[self::FEDORA_URL] = [ + '#type' => 'textfield', + '#title' => $this->t('Fedora URL'), + '#attributes' => array('readonly' => 'readonly'), + '#default_value' => t($fedora_url), + ]; + $selected_bundles = $config->get(self::GEMINI_PSEUDO); $options = []; @@ -202,7 +214,6 @@ class IslandoraSettingsForm extends ConfigFormBase { $this->t('Must enter Gemini URL before selecting bundles to display a pseudo field on.') ); } - } /**