1

I'm creating an extension where I should be able to call the logo which has been uploaded to Magento to show up in the home page.

So I upload the logo to:

Content -> Design -> Configuration -> Edit (Global) -> Header -> Logo Image

enter image description here

I have been investigating how Magento calls the logo:

vendor/magento/module-theme/Block/Html/Header/Logo.php

What would I need to add to my custom module in order to get this logo and show it. Thank you.

  • Did you try my solution? did it work for you? – Vivek Kumar Sep 4 '18 at 17:34
1

You need to inject \Magento\Theme\Block\Html\Header\Logo class in your block/controller and call getLogoSrc() method on its object to get the logo url and getLogoAlt() to get alt text.

Once you have it you can show it image tag in a phtml.

You can see a relevant tutorial here - https://www.mageplaza.com/how-get-logo-url-alt-text-logo-size-magento-2.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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