From d8877ea2fe28bd370868eb0da613b590a1acdc7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20D=C3=ADaz=20Soto?= Date: Wed, 4 Dec 2024 19:08:39 -0600 Subject: [PATCH] fix(shs-5963): load wysiwyg related scripts based on field type --- docroot/themes/humsci/humsci_basic/humsci_basic.theme | 3 ++- .../humsci/su_humsci_gin_admin/su_humsci_gin_admin.theme | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docroot/themes/humsci/humsci_basic/humsci_basic.theme b/docroot/themes/humsci/humsci_basic/humsci_basic.theme index fecd79bed5..a4a1c2b371 100644 --- a/docroot/themes/humsci/humsci_basic/humsci_basic.theme +++ b/docroot/themes/humsci/humsci_basic/humsci_basic.theme @@ -261,7 +261,8 @@ function humsci_basic_preprocess_paragraph(&$variables) { * Implements hook_preprocess_HOOK(). */ function humsci_basic_preprocess_field(&$variables) { - if ($variables['field_name'] == 'field_hs_text_area') { + $wysiwyg_types = ['text_long', 'text_with_summary']; + if (in_array($variables['field_type'], $wysiwyg_types)) { $variables['#attached']['library'][] = 'humsci_basic/table-wrap'; $variables['#attached']['library'][] = 'humsci_basic/table-scope'; $variables['#attached']['library'][] = 'humsci_basic/video-with-caption'; diff --git a/docroot/themes/humsci/su_humsci_gin_admin/su_humsci_gin_admin.theme b/docroot/themes/humsci/su_humsci_gin_admin/su_humsci_gin_admin.theme index ac943199ca..1e99489ee4 100644 --- a/docroot/themes/humsci/su_humsci_gin_admin/su_humsci_gin_admin.theme +++ b/docroot/themes/humsci/su_humsci_gin_admin/su_humsci_gin_admin.theme @@ -58,7 +58,8 @@ function su_humsci_gin_admin_preprocess(&$variables, $hook) { * Implements hook_preprocess_HOOK(). */ function su_humsci_gin_admin_preprocess_field(&$variables) { - if ($variables['field_name'] == 'field_hs_text_area') { + $wysiwyg_types = ['text_long', 'text_with_summary']; + if (in_array($variables['field_type'], $wysiwyg_types)) { $variables['#attached']['library'][] = 'humsci_basic/table-wrap'; $variables['#attached']['library'][] = 'humsci_basic/table-scope'; $variables['#attached']['library'][] = 'humsci_basic/video-with-caption';