namespace ScandiPWA\SocialShareGraphQl\Helper;
use Magento\Framework\App\Config\ScopeConfigInterface;
* @package ScandiPWA\SocialShareGraphQl\Helper
const SOCIALSHARE_CONFIG = 'socialshare/general/';
const SOCIALSHARE = 'socialshare/';
const ROUNDED = 'rounded';
const HOME_PAGE = 'home_page';
const CATEGORY_PAGE = 'category_page';
const PRODUCT_PAGE = 'product_page';
const COUNTER = 'enable_counter';
const FB_MSG = 'facebook_messenger';
* @var ScopeConfigInterface
* DataProvider constructor.
* @param ScopeConfigInterface $scopeConfig
public function __construct(
ScopeConfigInterface $scopeConfig
$this->scopeConfig = $scopeConfig;
public function getSocialShareConfig() {
'enabled' => $this->getConfig(self::SOCIALSHARE_CONFIG. self::ENABLE),
'rounded' => $this->getConfig(self::SOCIALSHARE_CONFIG. self::ROUNDED),
'size' => $this->getConfig(self::SOCIALSHARE_CONFIG. self::SIZE),
'categoryPage' => $this->getConfig(self::SOCIALSHARE_CONFIG. self::CATEGORY_PAGE),
'productPage' => $this->getConfig(self::SOCIALSHARE_CONFIG. self::PRODUCT_PAGE),
'homePage' => $this->getConfig(self::SOCIALSHARE_CONFIG. self::HOME_PAGE)
public function getSocialShareProviders() {
foreach (self::PROVIDERS as $provider) {
$data = $this->getFacebookMessengerData();
$data = $this->getEmailData();
$data = $this->getData($provider);
array_push($result, $data);
protected function getFacebookMessengerData() {
$enabled = $this->getProviderConfig(self::FB_MSG, self::ENABLE);
'additional' => $this->getProviderConfig(self::FB_MSG, self::APP_ID)
protected function getData($provider) {
$enabled = $this->getProviderConfig($provider, self::ENABLE);
'counter' => $this->getProviderConfig($provider, self::COUNTER)
protected function getEmailData() {
$enabled = $this->getProviderConfig(self::EMAIL, self::ENABLE);
'additional' => $this->getProviderConfig(self::EMAIL, self::SUFFIX)
protected function getConfig($path) {
return $this->scopeConfig->getValue($path);
protected function getProviderConfig($provider, $config) {
return $this->scopeConfig->getValue(self::SOCIALSHARE. $provider. '/'. $config);