Browse Source

styling

main
astanley 4 weeks ago
parent
commit
5a8c943f18
  1. 8
      .gitignore
  2. 13
      css/ror_widget.css
  3. 4
      islandora_ror.libraries.yml
  4. 34
      src/Plugin/Field/FieldWidget/RorWidget.php

8
.gitignore vendored

@ -0,0 +1,8 @@
# Ignore operating system specific files
.DS_Store
Thumbs.db
# Ignore IDE-specific files
.idea/
.vscode/
*.swp

13
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;
}

4
islandora_ror.libraries.yml

@ -0,0 +1,4 @@
ror_widget:
css:
theme:
css/ror_widget.css: {}

34
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;
}

Loading…
Cancel
Save