diff --git a/Block/Widget/Flow.php b/Block/Widget/Flow.php index 7bbdbf9..bd9a1b5 100644 --- a/Block/Widget/Flow.php +++ b/Block/Widget/Flow.php @@ -15,6 +15,8 @@ class Flow extends \Itonomy\Flowbox\Block\Base implements \Magento\Widget\Block\ private \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder; + private \Magento\Framework\Locale\Resolver $store; + /** * Flow constructor. * @param \Magento\Framework\View\Element\Template\Context $context @@ -22,6 +24,7 @@ class Flow extends \Itonomy\Flowbox\Block\Base implements \Magento\Widget\Block\ * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Cookie\Helper\Cookie $cookie * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor + * @param \Magento\Framework\Encryption\EncryptorInterface $store * @param array $data */ public function __construct( @@ -30,11 +33,13 @@ public function __construct( \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Cookie\Helper\Cookie $cookie, \Magento\Framework\Encryption\EncryptorInterface $encryptor, + \Magento\Framework\Locale\Resolver $store, array $data = [] ) { parent::__construct($context, $cookie, $encryptor, $data); $this->productRepository = $productRepository; $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->_store = $store; } /** @@ -50,7 +55,7 @@ protected function prepareConfig(): void 'flow' => $flow, 'key' => $this->escapeHtml((string) $this->getData('key')), 'lazyload' => (bool) $this->getData('lazyload'), - 'locale' => (string) $this->pageConfig->getElementAttribute('html', 'lang') + 'locale' => (string) $this->getData('locale') ?: $this->_store->getLocale() ]; if ($flow === static::FLOW_TYPE_DYNAMIC_PRODUCT) { diff --git a/etc/widget.xml b/etc/widget.xml index 63754fb..bf2ba7e 100644 --- a/etc/widget.xml +++ b/etc/widget.xml @@ -32,6 +32,14 @@ Visit flowbox]]> to access your flows. + + + Magento store locale will be used.
+ Visit here to see a list of supported locales. + ]]>
+
+