public function BlazyFilter::tips in Blazy 8.2
Same name and namespace in other branches
- 7 src/Plugin/Filter/BlazyFilter.php \Drupal\blazy\Plugin\Filter\BlazyFilter::tips()
Generates a filter's tip.
A filter's tips should be informative and to the point. Short tips are preferably one-liners.
@todo Split into getSummaryItem() and buildGuidelines().
Parameters
bool $long: Whether this callback should return a short tip to display in a form (FALSE), or whether a more elaborate filter tips should be returned for template_preprocess_filter_tips() (TRUE).
Return value
string|null Translated text to display as a tip, or NULL if this filter has no tip.
Overrides FilterBase::tips
File
- src/
Plugin/ Filter/ BlazyFilter.php, line 513
Class
- BlazyFilter
- Provides a filter to lazyload image, or iframe elements.
Namespace
Drupal\blazy\Plugin\FilterCode
public function tips($long = FALSE) {
if ($long) {
return $this
->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>
<p>To build a grid of images/ videos, add attribute <code>data-grid</code> or <code>data-column</code> (only to the first item):</p>
<ul>
<li><code><img data-grid="1 3 4" /></code></li>
<li><code><iframe data-column="1 3 4" /></code></li>
</ul>
<p>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 given a <code>data-unblazy</code>. Manually add width and height for SVG, and other images without image styles.</p>');
}
else {
return $this
->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>. Manually add width and height for SVG, and other images without image styles.');
}
}