From 9ffcdf353033783b06e4586f502e98e452be641d Mon Sep 17 00:00:00 2001 From: Lily Yan <lily.yan@uwaterloo.ca> Date: Thu, 7 Jan 2021 15:58:27 -0500 Subject: [PATCH] ISTWCMS-4210 Add mathjax.js to libraries and attach to page --- uw_cfg_common.libraries.yml | 3 +++ uw_cfg_common.module | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/uw_cfg_common.libraries.yml b/uw_cfg_common.libraries.yml index a2b27e50..4aabb6dc 100644 --- a/uw_cfg_common.libraries.yml +++ b/uw_cfg_common.libraries.yml @@ -33,3 +33,6 @@ uw_layout_inverted_l_left: css: theme: layouts/uw-inverted-l-left/uw-layout-inverted-l-left.css: {} +uw_mathjax: + js: + https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS_HTML: { type: external, minified: true } diff --git a/uw_cfg_common.module b/uw_cfg_common.module index f62c18c1..0f5298ec 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -259,6 +259,14 @@ function uw_cfg_common_preprocess_node(&$variables) { } } +/** + * Implements hook_page_attachments(). + */ +function uw_cfg_common_page_attachments(array &$page) { + $page['#attached']['library'][] = 'uw_cfg_common/uw_mathjax'; + +} + /** * Implements hook_form_FORM_ID_alter(). * -- GitLab