From a441faf8f91cb9d43704644483616de0ea7d7d80 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Fri, 27 Mar 2026 10:14:33 -0300 Subject: [PATCH] added a config schema update the settings form and add a update hook to remove the the unused config settings --- config/schema/upei_roblib_ill.schema.yml | 28 ++++++++++++++++++++++++ src/Form/RoblibIllSettingsForm.php | 3 --- upei_roblib_ill.install | 11 ++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 config/schema/upei_roblib_ill.schema.yml diff --git a/config/schema/upei_roblib_ill.schema.yml b/config/schema/upei_roblib_ill.schema.yml new file mode 100644 index 0000000..e4f1e86 --- /dev/null +++ b/config/schema/upei_roblib_ill.schema.yml @@ -0,0 +1,28 @@ +upei_roblib_ill.settings: + type: config_object + label: 'UPEI Roblib ILL settings' + mapping: + ill_library_symbol: + type: string + label: 'Your ILL Library Symbol' + ill_doi_openurl_pid: + type: string + label: 'OpenURL PID' + ill_contact_email: + type: string + label: 'Contact Email' + ill_contact_phone: + type: string + label: 'Contact Phone Number' + rapid_ill_username: + type: string + label: 'RapidILL Username' + rapid_ill_password: + type: string + label: 'RapidILL Password' + rapid_ill_code: + type: string + label: 'RapidILL Rapid Code' + rapid_ill_branch_name: + type: string + label: 'RapidILL Branch Name' diff --git a/src/Form/RoblibIllSettingsForm.php b/src/Form/RoblibIllSettingsForm.php index 006599f..2a65846 100644 --- a/src/Form/RoblibIllSettingsForm.php +++ b/src/Form/RoblibIllSettingsForm.php @@ -121,10 +121,7 @@ class RoblibIllSettingsForm extends FormBase public function submitForm(array &$form, FormStateInterface $form_state) { $config = \Drupal::configFactory()->getEditable('upei_roblib_ill.settings'); - $config->set('ill_add_url', $form_state->getValue('ill_add_url'))->save(); - $config->set('ill_auth_url', $form_state->getValue('ill_auth_url'))->save(); $config->set('ill_library_symbol', $form_state->getValue('ill_library_symbol'))->save(); - $config->set('ill_relais_key', $form_state->getValue('ill_relais_key'))->save(); $config->set('ill_doi_openurl_pid', $form_state->getValue('ill_doi_openurl_pid'))->save(); $config->set('ill_contact_email', $form_state->getValue('ill_contact_email'))->save(); $config->set('ill_contact_phone', $form_state->getValue('ill_contact_phone'))->save(); diff --git a/upei_roblib_ill.install b/upei_roblib_ill.install index f02855f..9a675ca 100644 --- a/upei_roblib_ill.install +++ b/upei_roblib_ill.install @@ -16,6 +16,17 @@ function upei_roblib_ill_update_7100() { ); } +/** + * Remove obsolete Relais configuration keys. + */ +function upei_roblib_ill_update_9301() { + \Drupal::configFactory()->getEditable('upei_roblib_ill.settings') + ->clear('ill_add_url') + ->clear('ill_auth_url') + ->clear('ill_relais_key') + ->save(); +} + /** * Implements hook_schema(). */