From 1a644dda1134b1ce60635db8d0ab5f09caaa03e4 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Fri, 28 Aug 2020 16:54:16 +0200 Subject: [PATCH] HFP-3008 Add content language to iframe document --- js/h5p.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index ee1888a..a7096e7 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -378,8 +378,11 @@ H5P.init = function (target) { // Insert H5Ps that should be in iframes. H5P.jQuery('iframe.h5p-iframe:not(.h5p-initialized)', target).each(function () { var contentId = H5P.jQuery(this).addClass('h5p-initialized').data('content-id'); + const contentData = H5PIntegration.contents['cid-' + contentId]; + const language = contentData && contentData.metadata && contentData.metadata.defaultLanguage + ? contentData.metadata.defaultLanguage : 'en'; this.contentDocument.open(); - this.contentDocument.write('' + H5P.getHeadTags(contentId) + '
'); + this.contentDocument.write('' + H5P.getHeadTags(contentId) + '
'); this.contentDocument.close(); }); };