diff --git a/config/install/islandora.settings.yml b/config/install/islandora.settings.yml new file mode 100644 index 00000000..bafdcd17 --- /dev/null +++ b/config/install/islandora.settings.yml @@ -0,0 +1,2 @@ +broker_url: 'http://localhost:61613' +triplestore_index_queue: '/islandora/triplestore/index' diff --git a/islandora.links.menu.yml b/islandora.links.menu.yml index 6527c19b..68f3f79b 100644 --- a/islandora.links.menu.yml +++ b/islandora.links.menu.yml @@ -6,3 +6,16 @@ entity.fedora_resource_type.collection: parent: system.admin_structure weight: 99 +# Menu list of Islandora configuration forms +system.admin_config_islandora: + title: Islandora + parent: system.admin_config + route_name: system.admin_config_islandora + weight: 100 + +# Core Islandora configuration form +system.islandora_settings: + title: 'Core Settings' + parent: system.admin_config_islandora + route_name: system.islandora_settings + description: 'Confgure core Islandora settings' diff --git a/islandora.routing.yml b/islandora.routing.yml index a228fc34..a5e27da7 100644 --- a/islandora.routing.yml +++ b/islandora.routing.yml @@ -9,4 +9,22 @@ entity.fedora_resource_type.rdftest: options: parameters: node_preview: - type: 'node_preview' \ No newline at end of file + type: 'node_preview' + +# Menu list of Islandora configuration forms +system.admin_config_islandora: + path: '/admin/config/islandora' + defaults: + _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + _title: 'Islandora' + requirements: + _permission: 'access administration pages' + +# Core Islandora configuration form +system.islandora_settings: + path: '/admin/config/islandora/core' + defaults: + _form: '\Drupal\islandora\Form\IslandoraSettingsForm' + _title: 'Islandora Settings' + requirements: + _permission: 'administer site configuration' diff --git a/src/Form/IslandoraSettingsForm.php b/src/Form/IslandoraSettingsForm.php new file mode 100644 index 00000000..33f4e23f --- /dev/null +++ b/src/Form/IslandoraSettingsForm.php @@ -0,0 +1,72 @@ +config(self::CONFIG_NAME); + + $form[self::BROKER_URL] = array( + '#type' => 'textfield', + '#title' => $this->t('Broker URL'), + '#default_value' => $config->get(self::BROKER_URL), + ); + + $form[self::TRIPLESTORE_INDEX_QUEUE] = array( + '#type' => 'textfield', + '#title' => $this->t('Triplestore Index Queue'), + '#default_value' => $config->get(self::TRIPLESTORE_INDEX_QUEUE), + ); + + return parent::buildForm($form, $form_state); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $config = \Drupal::service('config.factory')->getEditable(self::CONFIG_NAME); + + $config + ->set(self::BROKER_URL, $form_state->getValue(self::BROKER_URL)) + ->set(self::TRIPLESTORE_INDEX_QUEUE, $form_state->getValue(self::TRIPLESTORE_INDEX_QUEUE)) + ->save(); + + parent::submitForm($form, $form_state); + } +} +