Skip to content
Snippets Groups Projects
Select Git revision
  • 17cd8bd9f2b8197c1088d70feef2f3ab6e264b66
  • dev default protected
  • prod protected
  • 1.0.58
  • 1.0.57
  • 1.0.52
  • 1.0.56
  • 1.0.51
  • 1.0.50
  • 1.0.33
  • 1.0.32
  • 1.0.31
  • 1.0.30
  • 1.0.29
  • 1.0.28
  • 1.0.27
  • 1.0.26
  • 1.0.25
  • 1.0.24
  • 1.0.23
  • 1.0.22
  • 1.0.21
  • 1.0.20
23 results

TrackOrderLink.php

Blame
  • TrackOrderLink.php 1.03 KiB
    <?php
    
    namespace BobGroup\BobGo\Block;
    
    use Magento\Framework\View\Element\Html\Link\Current;
    use Magento\Framework\App\Config\ScopeConfigInterface;
    
    class TrackOrderLink extends Current
    {
        protected $scopeConfig;
    
        public function __construct(
            \Magento\Framework\View\Element\Template\Context $context,
            ScopeConfigInterface $scopeConfig,
            \Magento\Framework\App\DefaultPathInterface $defaultPath,
            array $data = []
        ) {
            $this->scopeConfig = $scopeConfig;
            parent::__construct($context, $defaultPath, $data);
        }
    
        protected function _toHtml()
        {
            // Check if the Track My Order feature is enabled
            $isEnabled = $this->scopeConfig->isSetFlag(
                'carriers/bobgo/enable_track_order',
                \Magento\Store\Model\ScopeInterface::SCOPE_STORE
            );
    
            // Return an empty string if the feature is disabled
            if (!$isEnabled) {
                return '';
            }
    
            // Use the parent class's rendering method
            return parent::_toHtml();
        }
    }