Browse Source

Fedora url (#742)

* fedora url

* save the config value

* form validation for fedora url

* get fedora_url from default settings.php

* travis syntax cleanup
pull/748/head
Natkeeran 5 years ago committed by dannylamb
parent
commit
63a035fd91
  1. 5
      src/EventGenerator/EventGenerator.php
  2. 13
      src/Form/IslandoraSettingsForm.php

5
src/EventGenerator/EventGenerator.php

@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\islandora\IslandoraUtils; use Drupal\islandora\IslandoraUtils;
use Drupal\islandora\MediaSource\MediaSourceService; use Drupal\islandora\MediaSource\MediaSourceService;
use Drupal\user\UserInterface; use Drupal\user\UserInterface;
use Drupal\Core\Site\Settings;
use Drupal\media\Entity\Media; use Drupal\media\Entity\Media;
use Drupal\Core\Entity\EntityStorageInterface; 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(); $entity_type = $entity->getEntityTypeId();
$event_type = $data["event"]; $event_type = $data["event"];
if ($data["event"] == "Generate Derivative") { if ($data["event"] == "Generate Derivative") {

13
src/Form/IslandoraSettingsForm.php

@ -6,6 +6,7 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeBundleInfo; use Drupal\Core\Entity\EntityTypeBundleInfo;
use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\Url; use Drupal\Core\Url;
use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\ConnectException;
use Islandora\Crayfish\Commons\Client\GeminiClient; use Islandora\Crayfish\Commons\Client\GeminiClient;
@ -24,6 +25,7 @@ class IslandoraSettingsForm extends ConfigFormBase {
const JWT_EXPIRY = 'jwt_expiry'; const JWT_EXPIRY = 'jwt_expiry';
const GEMINI_URL = 'gemini_url'; const GEMINI_URL = 'gemini_url';
const GEMINI_PSEUDO = 'gemini_pseudo_bundles'; const GEMINI_PSEUDO = 'gemini_pseudo_bundles';
const FEDORA_URL = 'fedora_url';
/** /**
* To list the available bundle types. * To list the available bundle types.
@ -96,6 +98,16 @@ class IslandoraSettingsForm extends ConfigFormBase {
'#default_value' => $config->get(self::GEMINI_URL), '#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); $selected_bundles = $config->get(self::GEMINI_PSEUDO);
$options = []; $options = [];
@ -202,7 +214,6 @@ class IslandoraSettingsForm extends ConfigFormBase {
$this->t('Must enter Gemini URL before selecting bundles to display a pseudo field on.') $this->t('Must enter Gemini URL before selecting bundles to display a pseudo field on.')
); );
} }
} }
/** /**

Loading…
Cancel
Save