From eeaa05bb3f807939265eb314abc12ce3a54949f3 Mon Sep 17 00:00:00 2001 From: dannylamb Date: Tue, 15 Nov 2016 08:26:52 -0400 Subject: [PATCH 1/2] Moving collection route to admin/content (#8) --- islandora.links.menu.yml | 8 -------- islandora.links.task.yml | 5 +++++ src/Entity/FedoraResource.php | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/islandora.links.menu.yml b/islandora.links.menu.yml index 4c4ed548..6527c19b 100644 --- a/islandora.links.menu.yml +++ b/islandora.links.menu.yml @@ -1,11 +1,3 @@ -# Fedora resource menu items definition -entity.fedora_resource.collection: - title: 'Fedora resource list' - route_name: entity.fedora_resource.collection - description: 'List Fedora resource entities' - parent: system.admin_structure - weight: 100 - # Fedora resource type menu items definition entity.fedora_resource_type.collection: title: 'Fedora resource type list' diff --git a/islandora.links.task.yml b/islandora.links.task.yml index 547e0758..e3096748 100644 --- a/islandora.links.task.yml +++ b/islandora.links.task.yml @@ -14,3 +14,8 @@ entity.fedora_resource.delete_form: base_route: entity.fedora_resource.canonical title: Delete weight: 10 + +entity.fedora_resource.collection: + route_name: entity.fedora_resource.collection + base_route: system.admin_content + title: 'Fedora Resources' diff --git a/src/Entity/FedoraResource.php b/src/Entity/FedoraResource.php index 0e58567d..f4238fd1 100644 --- a/src/Entity/FedoraResource.php +++ b/src/Entity/FedoraResource.php @@ -57,7 +57,7 @@ use Drupal\user\UserInterface; * "add-form" = "/fedora_resource/add/{fedora_resource_type}", * "edit-form" = "/fedora_resource/{fedora_resource}/edit", * "delete-form" = "/fedora_resource/{fedora_resource}/delete", - * "collection" = "/admin/structure/fedora_resource", + * "collection" = "/admin/content/fedora_resource", * }, * bundle_entity_type = "fedora_resource_type", * field_ui_base_route = "entity.fedora_resource_type.edit_form" @@ -293,7 +293,7 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); - + $fields['fedora_has_parent'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Fedora has Parent')) ->setDescription(t('Parent Fedora Resource.')) From a1d42b0db16d4da379f294ab63e3276c0b7d183b Mon Sep 17 00:00:00 2001 From: dannylamb Date: Tue, 15 Nov 2016 08:28:01 -0400 Subject: [PATCH 2/2] Config page for Islandora, plus some basic menu path entries to integrate with the Drupal admi n UI (#7) --- config/install/islandora.settings.yml | 2 + islandora.links.menu.yml | 13 +++++ islandora.routing.yml | 20 +++++++- src/Form/IslandoraSettingsForm.php | 72 +++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 config/install/islandora.settings.yml create mode 100644 src/Form/IslandoraSettingsForm.php 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); + } +} +