This module allows you to change the image data source attribute to "data-lazy" or "data-src" for some markup purposes or other functionality requirements.
Image may not display if you change the source attribute to "data-lazy" or "data-src". This will just provide an image markup with the data source that you've selected on the settings.
Instructions
- Install and enable this module.
- Go to "Manage display" on the image that you want to change the data source.
- Set up the formatter to "Image source".
- Change the settings to what you wanted to be applied to the image.
- Then Save.
Project link
https://www.drupal.org/project/image_source_formatter
Git instructions
git clone --branch 7.x-1.x https://git.drupalcode.org/project/image_source_formatter.git
PAReview checklist
https://pareview.sh/pareview/https-git.drupal.org-project-image_source_f...
Comments
Comment #2
carlagno CreditAttribution: carlagno commentedComment #3
montesajudy CreditAttribution: montesajudy commentedHello carlagno,
Please run automated review and check the errors.
- Git default branch is not set
- Your README.md does not follow best practices
Here is the report. https://pareview.sh/pareview/https-git.drupal.org-project-image_source_f...
Thanks
Comment #4
apadernoThank you for applying! I added the Git instructions for non-maintainer users and the PAReview checklist link. Reviewers will check the project and post comments to list what should be changed.
If you haven't done it, yet, please check the PAReview report and fix what needs to be fixed. There could be some false positives; verify that what reported is correct, before making any change.
Comment #5
vuil#7 was the reason to put the issue back in status "needs work".
Comment #6
apadernoIf the status is changed to Needs work, the OP should get a description of what needs to be changed, not even a comment saying this link shows what need to be fixed.
Comment #7
carlagno CreditAttribution: carlagno commented@montesajudy, @kiamlaluno
Thanks for reviewing this. I have now fixed the issues on PAReview. Could you please check it again.
Comment #8
montesajudy CreditAttribution: montesajudy commentedPAReview reports just a few errors that for me aren't application-blockers.
@kiamlaluno can we approve the application after a manual review?
Comment #9
apaderno@montesajudy It depends on what the review reports.
Comment #10
klausiThanks for your contribution!
* image_source_formatter_field_formatter_view(): do not use #markup and theme(), just directly return a render array. That way other modules and preprocessors can change stuff more easily.
* image_source_formatter_field_formatter_view(): this is vulnerable to XSS exploits. If I enter
a'><script>alert('XSS');</script>
as image alt text then I will get a nasty JavaScript popup. You need to sanitize all user provided text before printing to HTML. See https://www.drupal.org/docs/7/security/writing-secure-code/handle-text-i... . And please don't remove the security tag, we keep this for statistics and to show examples of security problems.Comment #11
carlagno CreditAttribution: carlagno commented@klausi
I have now updated and changed some of the code. Could you please check if this is correct. Thanks!
Comment #12
oranges13Hi there!
Most recent PAReview still shows some issues with README and a few other file errors
Review of the 7.x-1.x branch (commit 0dc8465):
hook_help()
. See https://www.drupal.org/docs/develop/documenting-your-project/module-docu... .This automated report was generated with PAReview.sh, your friendly project application review script.
*Manual Review*
The method in which you are calling
image_style_options
is a little bit weird, and that's leading to the "unused variable" message above. https://git.drupalcode.org/project/image_source_formatter/blob/7.x-1.x/i...I would instead just pass the parameters directly instead of assigning them to variables as you currently are.
I see you added
check_plain
around your inputs, great! But some are selects and don't accept user input -- do they need to be sanitized as well? https://git.drupalcode.org/project/image_source_formatter/blob/7.x-1.x/i...From my cursory examination, that's all I could identify. This seems like a useful module though!
Comment #13
carlagno CreditAttribution: carlagno commentedHi @oranges13
Thank you for the review and comments!
I have now fixed the issues on PAReview. Also, i have already added an automated testing on this.
However, it's not yet reflecting on PAReview.
I have now also, remove the unused variable here.
https://git.drupalcode.org/project/image_source_formatter/blob/7.x-1.x/image_source_formatter.module#L37
Also, i have now removed the check_plain on the selects. The users have no access to input on this so i think it doesn't to be sanitized.
https://git.drupalcode.org/project/image_source_formatter/blob/7.x-1.x/image_source_formatter.module#L97
Thanks on some tips and comments!
Comment #14
apadernoRemember to change status, if all the reported issues have been fixed.
Comment #15
carlagno CreditAttribution: carlagno commentedComment #16
carlagno CreditAttribution: carlagno commented@kiamlaluno
Thanks for informing me, I'm really not aware of that. I have now changed the status.
Comment #17
klausiI think this needs review now again.
Comment #18
klausiReviewed this again, looks good to me!
Comment #19
apadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #20
carlagno CreditAttribution: carlagno commentedNoted on these recommendations. Thank you for updating my account and to all the reviewers as well!
Comment #21
vuil@carlagno You are welcome!
;)
Comment #22
vuilComment #24
vuil