Question

I want to add a custom text area for contact info for a particular store view from configuration and get that custom field value and display it on the contact us page in Magento 2.3.2.

so can anyone have an idea then please share it with me.

Thanks in Advance...

Was it helpful?

Solution

Try This code

<?php

namespace Vendorename\Modulename\Helper;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;


class Data extends AbstractHelper
{
    const XML_PATH_ENABLE = 'sectionname/groupname/fieldname';

    protected $_scopeConfig;


    public function __construct(
        ....................................
        ScopeConfigInterface $scopeConfig,
        ....................................
    ) {
        ....................................
        $this->_scopeConfig = $scopeConfig;
        ....................................
    }

    public function isEnabled()
    {
        return $this->_scopeConfig->getValue(self::XML_PATH_ENABLE, ScopeInterface::SCOPE_STORE);
    }

}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top