-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martyna Maciejewska
committed
Nov 28, 2024
1 parent
6c74665
commit 3ac5ea2
Showing
4 changed files
with
94 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Snowdog\Menu\Ui\Component\Menu\Form\Element; | ||
|
||
use Magento\Framework\Option\ArrayInterface; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
class StoreView implements ArrayInterface | ||
{ | ||
/** | ||
* @var StoreManagerInterface | ||
*/ | ||
private $storeManager; | ||
|
||
/** | ||
* @param StoreManagerInterface $storeManager | ||
*/ | ||
public function __construct( | ||
StoreManagerInterface $storeManager | ||
) { | ||
$this->storeManager = $storeManager; | ||
} | ||
|
||
public function toOptionArray(): array | ||
{ | ||
$stores = $this->storeManager->getStores(); | ||
|
||
$options = []; | ||
foreach ($stores as $store) { | ||
$options[] = [ | ||
'label' => $store->getName(), | ||
'value' => $store->getId(), | ||
]; | ||
} | ||
|
||
return $options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters