Template.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Smartwave\Porto\Block;
  3. class Template extends \Magento\Framework\View\Element\Template {
  4. public $_coreRegistry;
  5. public function __construct(
  6. \Magento\Backend\Block\Template\Context $context,
  7. \Magento\Framework\Registry $coreRegistry,
  8. array $data = []
  9. ) {
  10. $this->_coreRegistry = $coreRegistry;
  11. parent::__construct($context, $data);
  12. }
  13. public function getConfig($config_path, $storeCode = null)
  14. {
  15. return $this->_scopeConfig->getValue(
  16. $config_path,
  17. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  18. $storeCode
  19. );
  20. }
  21. public function getFooterLogoSrc(){
  22. $folderName = \Smartwave\Porto\Model\Config\Backend\Image\Logo::UPLOAD_DIR;
  23. $storeLogoPath = $this->_scopeConfig->getValue(
  24. 'porto_settings/footer/footer_logo_src',
  25. \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  26. );
  27. $path = $folderName . '/' . $storeLogoPath;
  28. $logoUrl = $this->_urlBuilder
  29. ->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]) . $path;
  30. return $logoUrl;
  31. }
  32. public function isHomePage()
  33. {
  34. $currentUrl = $this->getUrl('', ['_current' => true]);
  35. $urlRewrite = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);
  36. return $currentUrl == $urlRewrite;
  37. }
  38. }
  39. ?>