Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default attributes for native lazy loading #24

Merged

Conversation

alexander-schranz
Copy link
Member

Native lazy loading

Browsers today have native support for lazy-loading.

You can do the following:

{{ get_image(image, {
    src: '800x',
    loading: 'lazy',
}) }}

This pull requests add default attributes so you can add specific attributes to all your get_image tagged calls by using the following service definition:

services:
    Sulu\Twig\Extensions\ImageExtension:
        arguments:
            - null
            - { loading: 'lazy' }

src/ImageExtension.php Show resolved Hide resolved
docs/image.md Outdated Show resolved Hide resolved
docs/image.md Outdated Show resolved Hide resolved
Copy link
Contributor

@luca-rath luca-rath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! can be merged now :)

@alexander-schranz alexander-schranz merged commit d4df8d3 into sulu:master Mar 31, 2020
@alexander-schranz alexander-schranz deleted the feature/default-attributes branch March 31, 2020 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants