Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Source.php
Go to the documentation of this file.
1 <?php
7 
10 
11 class Source implements ArrayInterface
12 {
16  protected $scopeResolverPool;
17 
21  protected $scope;
22 
27  public function __construct(
29  $scope
30  ) {
31  $this->scopeResolverPool = $scopeResolverPool;
32  $this->scope = $scope;
33  }
34 
40  public function toOptionArray()
41  {
42  $scopes = $this->scopeResolverPool->get($this->scope)->getScopes();
43  $array = [];
44  foreach ($scopes as $scope) {
45  $array[] = ['value' => $scope->getId(), 'label' => $scope->getName()];
46  }
47  return $array;
48  }
49 }
__construct(ScopeResolverPool $scopeResolverPool, $scope)
Definition: Source.php:27