From 5a8c943f18840d6f0e9a2c7ea2423254481f72b1 Mon Sep 17 00:00:00 2001 From: astanley Date: Thu, 20 Nov 2025 16:01:21 -0400 Subject: [PATCH] styling --- .gitignore | 8 +++++ css/ror_widget.css | 13 +++++++++ islandora_ror.libraries.yml | 4 +++ src/Plugin/Field/FieldWidget/RorWidget.php | 34 +++++++++++++++++----- 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .gitignore create mode 100644 css/ror_widget.css create mode 100644 islandora_ror.libraries.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a17e577 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ + # Ignore operating system specific files + .DS_Store + Thumbs.db + + # Ignore IDE-specific files + .idea/ + .vscode/ + *.swp diff --git a/css/ror_widget.css b/css/ror_widget.css new file mode 100644 index 0000000..095052e --- /dev/null +++ b/css/ror_widget.css @@ -0,0 +1,13 @@ +/* Grey-out read-only ROR fields */ +input.ror-readonly[readonly] { + background-color: #f3f3f3; + color: #666; + border-color: #ccc; + cursor: not-allowed; +} + +/* dim labels*/ +input.ror-readonly[readonly] + label, +.form-item input.ror-readonly[readonly] { + opacity: 0.8; +} diff --git a/islandora_ror.libraries.yml b/islandora_ror.libraries.yml new file mode 100644 index 0000000..e36539c --- /dev/null +++ b/islandora_ror.libraries.yml @@ -0,0 +1,4 @@ +ror_widget: + css: + theme: + css/ror_widget.css: {} diff --git a/src/Plugin/Field/FieldWidget/RorWidget.php b/src/Plugin/Field/FieldWidget/RorWidget.php index ac9a9d7..0ca64d8 100644 --- a/src/Plugin/Field/FieldWidget/RorWidget.php +++ b/src/Plugin/Field/FieldWidget/RorWidget.php @@ -66,39 +66,59 @@ class RorWidget extends WidgetBase { ], ]; +// $element['details'] = [ +// '#type' => 'container', +// '#attributes' => ['id' => $wrapper_id], +// ]; $element['details'] = [ - '#type' => 'container', - '#attributes' => ['id' => $wrapper_id], + '#type' => 'fieldset', + '#title' => $this->t('Details retrieved from ROR'), + '#attributes' => [ + 'class' => ['ror-details-fieldset'], + 'id' => $wrapper_id, + ], ]; $element['details']['id'] = [ '#type' => 'textfield', '#title' => $this->t('ROR ID'), '#default_value' => $id, - '#attributes' => ['readonly' => 'readonly'], + '#attributes' => [ + 'readonly' => 'readonly', + 'class' => ['ror-readonly'], + ], ]; $element['details']['name'] = [ '#type' => 'textfield', '#title' => $this->t('Name'), '#default_value' => $name, - '#attributes' => ['readonly' => 'readonly'], + '#attributes' => [ + 'readonly' => 'readonly', + 'class' => ['ror-readonly'], + ], ]; $element['details']['website'] = [ '#type' => 'textfield', '#title' => $this->t('Website'), '#default_value' => $website, - '#attributes' => ['readonly' => 'readonly'], + '#attributes' => [ + 'readonly' => 'readonly', + 'class' => ['ror-readonly'], + ], ]; $element['details']['wikipedia'] = [ '#type' => 'textfield', '#title' => $this->t('Wikipedia'), '#default_value' => $wikipedia, - '#attributes' => ['readonly' => 'readonly'], + '#attributes' => [ + 'readonly' => 'readonly', + 'class' => ['ror-readonly'], + ], ]; - + $element['#attached']['library'][] = 'islandora_ror/ror_widget'; return $element; }