Skip to content

Commit

Permalink
fix(shs-5963): load wysiwyg related scripts based on field type
Browse files Browse the repository at this point in the history
  • Loading branch information
cienvaras committed Dec 5, 2024
1 parent f5dc114 commit d8877ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docroot/themes/humsci/humsci_basic/humsci_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit d8877ea

Please sign in to comment.