public function BlazyFilter::tips in Blazy 7
Same name and namespace in other branches
- 8.2 src/Plugin/Filter/BlazyFilter.php \Drupal\blazy\Plugin\Filter\BlazyFilter::tips()
File
- src/
Plugin/ Filter/ BlazyFilter.php, line 327
Class
- BlazyFilter
- Provides a filter to lazyload image, or iframe elements.
Namespace
Drupal\blazy\Plugin\FilterCode
public function tips($filter, $long = FALSE) {
if ($long) {
$tips = t('<p><strong>Blazy</strong>: Image or iframe is lazyloaded. To disable, add attribute <code>data-unblazy</code>:</p>
<ul>
<li><code><img data-unblazy /></code></li>
<li><code><iframe data-unblazy /></code></li>
</ul>');
if ($filter->settings['grid'] || $filter->settings['column']) {
if ($filter->settings['grid']) {
$tips .= t('<p>To build a grid of images/ videos, add attribute <code>data-grid</code> (only to the first item):
<ul>
<li>For images: <code><img data-grid="1 3 4" /></code></li>
<li>For videos: <code><iframe data-grid="1 3 4" /></code></li>
<li>If both media types are present, choose only the first item.</li>
</ul>');
}
if ($filter->settings['column']) {
$tips .= t('<p>To build a CSS3 Masonry columns of images/ videos, add attribute <code>data-column</code> (only to the first item):
<ul>
<li>For images: <code><img data-column="1 3 4" /></code></li>
<li>For videos: <code><iframe data-column="1 3 4" /></code></li>
<li>If both media types are present, choose only the first item.</li>
</ul>');
}
$tips .= t('The numbers represent the amount of grids/ columns for small, medium and large devices respectively, space delimited. Be aware! All media items will be grouped regardless of their placements, unless those disabled via <code>data-unblazy</code>. This is also required if using <b>Image to lightbox</b> (Colorbox, Photobox, PhotoSwipe). Only one block of grids or columns can exist at a time in a particular body text.</p>');
}
return $tips;
}
else {
return t('To disable lazyload, add attribute <code>data-unblazy</code> to <code><img></code> or <code><iframe></code> elements. Examples: <code><img data-unblazy</code> or <code><iframe data-unblazy</code>.');
}
}