From 9afb887bc4cd830ea49084d0e54498e694584d2c Mon Sep 17 00:00:00 2001 From: Brian Cassidy Date: Wed, 17 Apr 2024 14:48:24 -0300 Subject: [PATCH] LIB-511 add linked collections field --- config-yml/search_api.index.eresources.yml | 9 +++++++++ .../modules/eresources/src/Entity/Record.php | 19 +++++++++++++++++++ .../templates/eresources-record.html.twig | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/config-yml/search_api.index.eresources.yml b/config-yml/search_api.index.eresources.yml index d4bff3b1..b6193e17 100644 --- a/config-yml/search_api.index.eresources.yml +++ b/config-yml/search_api.index.eresources.yml @@ -159,6 +159,14 @@ field_settings: dependencies: module: - eresources + linked_collections: + label: 'Linked Collections' + datasource_id: 'entity:eresources_record' + property_path: linked_collections + type: text + dependencies: + module: + - eresources metadata_local_access_information: label: 'Local Metadata: Access Information' datasource_id: 'entity:eresources_record' @@ -302,6 +310,7 @@ processor_settings: add_url: { } aggregated_field: { } auto_aggregated_fulltext_field: { } + custom_value: { } entity_type: { } language_with_fallback: { } rendered_item: { } diff --git a/custom/modules/eresources/src/Entity/Record.php b/custom/modules/eresources/src/Entity/Record.php index a99b159e..c70144b2 100644 --- a/custom/modules/eresources/src/Entity/Record.php +++ b/custom/modules/eresources/src/Entity/Record.php @@ -298,6 +298,25 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ]) ->setDisplayConfigurable('form', TRUE); + $fields['linked_collections'] = BaseFieldDefinition::create('string_long') + ->setLabel(t('Linked Collections')) + ->setRequired(FALSE) + ->setSettings( + [ + 'default_value' => '', + 'max_length' => 1024, + ] + ) + ->setDisplayOptions('form', [ + 'type' => 'string_textarea', + 'weight' => 0, + 'settings' => [ + 'rows' => 7, + 'placeholder' => "Title,URL\nTitle,URL", + ], + ]) + ->setDisplayConfigurable('form', TRUE); + $fields['is_local'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Mark as a custom local record')) ->setDescription(t('A boolean indicating whether the Record is a custom local record.')) diff --git a/custom/modules/eresources/templates/eresources-record.html.twig b/custom/modules/eresources/templates/eresources-record.html.twig index dd4fe1a6..88bf9fb4 100644 --- a/custom/modules/eresources/templates/eresources-record.html.twig +++ b/custom/modules/eresources/templates/eresources-record.html.twig @@ -4,7 +4,7 @@ {% set fields = [ 'id', 'entry_uid', 'title', 'oclcnum', 'isbn', 'issn', 'eissn', 'url', 'author', 'publisher', 'coverage', 'coverageenum', - 'coverage_notes', 'collection_user_notes', 'location', + 'coverage_notes', 'collection_user_notes', 'location', 'linked_collections', 'kb_data_type', 'status', ] %} {% for field in fields %}