I'm trying to get a configuration for my custom module
My Custom module overrides \Magento\Swatches\Block\Product\Renderer\Configurable
With the following Code:
namespace Vendor\swatchExtender\Block;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Helper\Product as CatalogProduct;
use Magento\Catalog\Model\Product;
use Magento\ConfigurableProduct\Helper\Data;
use Magento\ConfigurableProduct\Model\ConfigurableAttributeData;
use Magento\Customer\Helper\Session\CurrentCustomer;
use Magento\Framework\Json\EncoderInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Stdlib\ArrayUtils;
use Magento\Store\Model\ScopeInterface;
use Magento\Swatches\Helper\Data as SwatchData;
use Magento\Swatches\Helper\Media;
use Magento\Swatches\Model\Swatch;
use Magento\Framework\App\ObjectManager;
use Magento\Swatches\Model\SwatchAttributesProvider;
class Configurable extends \Magento\Swatches\Block\Product\Renderer\Configurable
{
protected function extractNecessarySwatchData(array $swatchDataArray)
{
$result['type'] = $swatchDataArray['type'];
if ($result['type'] == Swatch::SWATCH_TYPE_VISUAL_IMAGE && !empty($swatchDataArray['value'])) {
$result['value'] = $this->swatchMediaHelper->getSwatchAttributeImage(
Swatch::SWATCH_IMAGE_NAME,
$swatchDataArray['value']
);
$result['thumb'] = $this->swatchMediaHelper->getSwatchAttributeImage(
Swatch::SWATCH_THUMBNAIL_NAME,
$swatchDataArray['value']
);
} else {
$result['value'] = $swatchDataArray['value'];
}
$result['custom_parameter'] = 'value';
}
}
But now i want to read the configuation parameters from the admin-panel.
I have created a Helper data Class:
namespace Vendor\swatchExtender\Helper;
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
public function getConfig($config_path)
{
return $this->scopeConfig->getValue(
$config_path,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
}
But i have no idea how to access the Helper/data, everything i tried will brake the Configurable class, because of the parent __Construct,
How can i Access my Helper/Data class ?