Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AllowedCountries.php
Go to the documentation of this file.
1 <?php
8 
13 
18 {
22  private $shareConfig;
23 
27  private $storeManager;
28 
33  public function __construct(
34  Share $share,
35  StoreManagerInterface $storeManager
36  ) {
37  $this->shareConfig = $share;
38  $this->storeManager = $storeManager;
39  }
40 
50  public function beforeGetAllowedCountries(
51  \Magento\Directory\Model\AllowedCountries $subject,
53  $scopeCode = null
54  ) {
55  if ($this->shareConfig->isGlobalScope()) {
56  //Check if we have shared accounts - than merge all website allowed countries
57  $scopeCode = array_map(function (WebsiteInterface $website) {
58  return $website->getId();
59  }, $this->storeManager->getWebsites());
61  }
62 
63  return [$scope, $scopeCode];
64  }
65 }
__construct(Share $share, StoreManagerInterface $storeManager)
$storeManager
beforeGetAllowedCountries(\Magento\Directory\Model\AllowedCountries $subject, $scope=ScopeInterface::SCOPE_WEBSITE, $scopeCode=null)