-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
D8CORE-7255 exclude lazy load oembed links from external links (#760)
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
themes/stanford_basic/templates/contrib/oembed-lazyload-placeholder.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{# | ||
/** | ||
* @file | ||
* Default theme implementation of a an oembed lazyload placeholder. | ||
* | ||
* Available variables: | ||
* - title: The oembed resource title. | ||
* - url: The oembed resource url. | ||
* - provider: The provider of the oembed content. | ||
* - settings: The configured formatter settings. | ||
* - third_party_settings: Any third party settings passed on by a specific provider. | ||
* | ||
* @see template_preprocess_oembed_lazyload_placeholder() | ||
* | ||
* @ingroup themeable | ||
*/ | ||
#} | ||
{% apply spaceless %} | ||
{% if title is empty %} | ||
{% set title = '' %} | ||
{% endif %} | ||
{% if settings['strategy'] == 'onclick' %} | ||
<button class="oembed-lazyload__button" title="{% trans %}Watch {{ title }}{% endtrans %}"> | ||
<span class="oembed-lazyload__visible-label">{% trans %}Load video{% endtrans %}</span> | ||
{% if title %} | ||
<span class="visually-hidden">{{ title }}</span> | ||
{% endif %} | ||
<span class="oembed-lazyload__thumbnail" style="background-image: url('{{ thumbnail }}')"></span> | ||
</button> | ||
{% else %} | ||
<a class="oembed-lazyload__button" href="{{ url }}" aria-label="{% trans %}Watch {{ title }}{% endtrans %}" rel="nofollow"> | ||
<span class="oembed-lazyload__thumbnail" style="background-image: url('{{ thumbnail }}')"></span> | ||
</a> | ||
{% endif %} | ||
{% endapply %} |