Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/code/Magento/Store/Model/System/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Store\Model\System;

use Magento\Framework\Data\OptionSourceInterface;
Expand Down Expand Up @@ -118,6 +121,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
$options[] = ['label' => __('All Store Views'), 'value' => 0];
}

// phpcs:ignore Magento2.Functions.DiscouragedFunction
$nonEscapableNbspChar = html_entity_decode(' ', ENT_NOQUOTES, 'UTF-8');

foreach ($this->_websiteCollection as $website) {
Expand All @@ -126,7 +130,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
if ($website->getId() != $group->getWebsiteId()) {
continue;
}
$groupShow = false;
$values = [];
foreach ($this->_storeCollection as $store) {
if ($group->getId() != $store->getGroupId()) {
continue;
Expand All @@ -135,16 +139,12 @@ public function getStoreValuesForForm($empty = false, $all = false)
$options[] = ['label' => $website->getName(), 'value' => []];
$websiteShow = true;
}
if (!$groupShow) {
$groupShow = true;
$values = [];
}
$values[] = [
'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(),
'value' => $store->getId(),
];
}
if ($groupShow) {
if (!empty($values)) {
$options[] = [
'label' => str_repeat($nonEscapableNbspChar, 4) . $group->getName(),
'value' => $values,
Expand Down Expand Up @@ -398,6 +398,7 @@ public function getStoreCollection()

/**
* Load/Reload collection(s) by type
*
* Allowed types: website, group, store or null for all
*
* @param string $type
Expand Down