Skip to content

Commit

Permalink
Merge pull request #10 from nswdpc/fix-polyfill-ss5
Browse files Browse the repository at this point in the history
Fix: polyfill check
  • Loading branch information
tardinha authored Sep 23, 2024
2 parents 7540aba + 613443f commit 6579a08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Models/Elements/ElementIframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,11 @@ public function getCMSFields() {
return $fields;
}

/**
* Return whether lazy load polyfill is enabled, useful in templates
*/
public function HasPolyfill(): bool {
return (bool)self::config()->get('load_polyfill');
}

}
4 changes: 2 additions & 2 deletions templates/NSWDPC/Elemental/Models/Iframe/ElementIframe.ss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="content-element__content<% if $StyleVariant %> {$StyleVariant}<% end_if %>">
<% include ElementIframeTitle %>
<div class="outer<% if $IsDynamic %> iframe-resizer<% end_if %><% if $IsResponsive %> responsive-iframe is-{$IsResponsive.XML}<% end_if %>">
<% if $IsLazy %><noscript class="loading-lazy"><% end_if %>
<% if $IsLazy && $HasPolyfill %><noscript class="loading-lazy"><% end_if %>
<iframe
<% if $AlternateContent %>title="{$AlternateContent.XML}"<% end_if %>
class="<% if $IsResponsive %> responsive-item<% end_if %>"
Expand All @@ -13,6 +13,6 @@
src="{$URL.LinkURL.XML}"
frameborder="0">
</iframe>
<% if $IsLazy %></noscript><% end_if %>
<% if $IsLazy && $HasPolyfill %></noscript><% end_if %>
</div>
</div>

0 comments on commit 6579a08

Please sign in to comment.