*/ public function getStoreViewOptions(): array { $result = []; $stores = $this->storeManager->getStores(true, false); foreach ($stores as $store) { if (!$store instanceof Store) { continue; } if (!(int)$store->getId()) { continue; } if (!$store->isActive()) { continue; } $result[] = [ 'store_id' => (int)$store->getId(), 'code' => (string)$store->getCode(), 'label' => (string)$store->getName(), 'website' => (string)$store->getWebsite()->getName(), 'group' => (string)$store->getGroup()->getName(), 'locale' => (string)$this->scopeConfig->getValue( 'general/locale/code', ScopeInterface::SCOPE_STORE, (int)$store->getId() ), ]; } return $result; } /** * @return array>}> */ public function getStoreViewGroups(): array { $groups = []; foreach ($this->getStoreViewOptions() as $store) { $website = (string)$store['website']; if (!isset($groups[$website])) { $groups[$website] = [ 'website' => $website, 'stores' => [], ]; } $groups[$website]['stores'][] = $store; } return array_values($groups); } public function getDefaultSourceStoreId(): int { return Store::DEFAULT_STORE_ID; } }