1

My extension comes with an icon, where can I place it in my module and how can I load it in the modules template?

Template:

<img src="/media/icons/new-badge.svg" class="new-icon" alt="NEW">
5
  • where it is placed at the moment ?
    – Pawan
    Apr 29, 2020 at 9:00
  • In app/code/VENDOR/MODULE
    – Black
    Apr 29, 2020 at 9:07
  • 1
    you can put at app/code/VENDOR/MODULE/view/frontend/web/images
    – Pawan
    Apr 29, 2020 at 9:15
  • And how can I access it from the template?
    – Black
    Apr 29, 2020 at 9:16
  • 1
    You can access it by : <img src="<?php echo $this->getViewFileUrl('VENDOR_MODULE::images/icon.png'); ?>">
    – Pawan
    Apr 29, 2020 at 9:17

1 Answer 1

1

You can put icon/images at:

app/code/VENDOR/MODULE/view/frontend/web/images

to access those image in template, You can use:

 <img src="<?php echo $this->getViewFileUrl('VENDOR_MODULE::images/icon.png'); ?>">

Hope above will help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.