Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ScopeTreeProvider.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Store\Model;
7 
13 
15 {
19  protected $storeManager;
20 
24  public function __construct(
26  ) {
27  $this->storeManager = $storeManager;
28  }
29 
33  public function get()
34  {
35  $defaultScope = [
37  'scope_id' => null,
38  'scopes' => [],
39  ];
40 
42  foreach ($this->storeManager->getWebsites() as $website) {
43  $websiteScope = [
45  'scope_id' => $website->getId(),
46  'scopes' => [],
47  ];
48 
50  foreach ($website->getGroups() as $group) {
51  $groupScope = [
52  'scope' => ScopeInterface::SCOPE_GROUP,
53  'scope_id' => $group->getId(),
54  'scopes' => [],
55  ];
56 
58  foreach ($group->getStores() as $store) {
59  $storeScope = [
61  'scope_id' => $store->getId(),
62  'scopes' => [],
63  ];
64  $groupScope['scopes'][] = $storeScope;
65  }
66  $websiteScope['scopes'][] = $groupScope;
67  }
68  $defaultScope['scopes'][] = $websiteScope;
69  }
70  return $defaultScope;
71  }
72 }
$group
Definition: sections.phtml:16
__construct(StoreManagerInterface $storeManager)