From da37a775587cc5e4d3b82c14fc3d29192c42b534 Mon Sep 17 00:00:00 2001 From: Akanksha Date: Tue, 5 Dec 2023 13:37:38 -0400 Subject: [PATCH 1/2] 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; From 61be835d2160bcac24c801f5d9de43844267de23 Mon Sep 17 00:00:00 2001 From: Akanksha Date: Tue, 5 Dec 2023 13:38:57 -0400 Subject: [PATCH 2/2] DGIR-116: Copy citation button --- src/Form/SelectCslForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/SelectCslForm.php b/src/Form/SelectCslForm.php index cbb04b1..fc3a9ee 100644 --- a/src/Form/SelectCslForm.php +++ b/src/Form/SelectCslForm.php @@ -112,7 +112,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['actions']['submit'] = [ '#type' => 'button', - '#value' => $this->t('Copy Citation'), + '#value' => $this->t('Copy to Clipboard'), '#attributes' => [ 'onclick' => 'return false;', 'class' => ['clipboard-button'],