Contact us page is Enable or not, Check using Programmatically way by Magento 2.
By Default from Admin panel, you can verify it by Stores -> Configuration -> Contacts tab.
Using Coding, You can verify by getting contacts section, group, and field id value and pass it to the scopeConfig Object of Magento\Store\Model\ScopeInterface.
contact/contact/enabled is the configuration value for contact us page.
<?php
use Magento\Store\Model\ScopeInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
public function __construct(
ScopeConfigInterface $scopeConfig
) {
$this->scopeConfig = $scopeConfig;
}
/**
* @return bool
*/
public function getContactUsEnabled()
{
return (bool)$this->scopeConfig->getValue(
'contact/contact/enabled',
ScopeInterface::SCOPE_STORE
);
}
Call function by,
$this->getContactUsEnabled() // true|false
The Result is always boolean. True or false based on admin panel settings.
