Commit 2948326b authored by osman's avatar osman

Issue #3048186 Fix text-format tips

parent 1fe48936
......@@ -81,21 +81,26 @@ class LazyFilter extends FilterBase {
* {@inheritdoc}
*/
public function tips($long = FALSE) {
$tags = \Drupal::config('lazy.blazy')->get('alter_tag');
$tags = implode(' ', $tags);
$tags = trim(str_replace(['0'], '', $tags));
$settings = \Drupal::config('lazy.settings');
$tags = $settings->get('alter_tag');
$skip = $settings->get('skipClass');
$options = ['%img' => '<img>', '%iframe' => '<iframe>'];
switch ($tags) {
case 'img':
return t('%img elements are lazy-loaded.', $options);
case 'iframe':
return t('%iframe elements are lazy-loaded.', $options);
$skip_help = t('If you want certain elements skip lazy-loading, add <code>%class</code> class name.', ['%class' => $skip]);
case 'img iframe':
default:
return t('Both %img and %iframe elements are lazy-loaded.', $options);
if (!empty($tags)) {
if ($tags['img'] && $tags['iframe']) {
return t('Lazy-loading is enabled for both %img and %iframe tags.', $options) . ' ' . $skip_help;
}
elseif ($tags['img']) {
return t('Lazy-loading is enabled for %img tags.', $options) . ' ' . $skip_help;
}
elseif ($tags['iframe']) {
return t('Lazy-loading is enabled for %iframe tags.', $options) . ' ' . $skip_help;
}
}
return t('Lazy-loading is not enabled.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment