Browse Source

Issue #3356080: Add lazy loading parameter to drupal_image() or add attribute example in Cheat Sheet

merge-requests/34/head
Julian Pustkuchen 10 months ago committed by Ivan
parent
commit
248ea4d7db
  1. 5
      docs/cheat-sheet.md

5
docs/cheat-sheet.md

@ -114,6 +114,11 @@ options, which is documented here: https://api.drupal.org/api/drupal/core!lib!Dr
{# Render image using 'thumbnail' image style and custom attributes. #} {# Render image using 'thumbnail' image style and custom attributes. #}
{{ drupal_image('public://ocean.jpg', 'thumbnail', {alt: 'The alternative text'|t, title: 'The title text'|t}) }} {{ drupal_image('public://ocean.jpg', 'thumbnail', {alt: 'The alternative text'|t, title: 'The title text'|t}) }}
{# Render image using 'thumbnail' image style with lazy/eager loading (by attribute). #}
{{ drupal_image('public://ocean.jpg', 'thumbnail', {loading: 'lazy'}) }}
{{ drupal_image('public://ocean.jpg', 'thumbnail', {loading: 'eager'}) }}
{# Render responsive image. #}
{# Render responsive image (using a named argument). #} {# Render responsive image (using a named argument). #}
{{ drupal_image('public://ocean.jpg', 'wide', responsive=true) }} {{ drupal_image('public://ocean.jpg', 'wide', responsive=true) }}
``` ```

Loading…
Cancel
Save