From da37a775587cc5e4d3b82c14fc3d29192c42b534 Mon Sep 17 00:00:00 2001 From: Akanksha Date: Tue, 5 Dec 2023 13:37:38 -0400 Subject: [PATCH] DGIR-116: Copy citation button --- src/Form/SelectCslForm.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Form/SelectCslForm.php b/src/Form/SelectCslForm.php index 96f331b..cbb04b1 100644 --- a/src/Form/SelectCslForm.php +++ b/src/Form/SelectCslForm.php @@ -110,6 +110,21 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#theme_wrappers' => [], ]; + $form['actions']['submit'] = [ + '#type' => 'button', + '#value' => $this->t('Copy Citation'), + '#attributes' => [ + 'onclick' => 'return false;', + 'class' => ['clipboard-button'], + 'data-clipboard-target' => '#formatted-citation', + ], + '#attached' => [ + 'library' => [ + 'islandora_citations/drupal', + ], + ], + ]; + $form['#cache']['contexts'][] = 'url'; $form['#theme'] = 'display_citations'; return $form;