-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from mageplaza/2.4-develop
2.4 develop
- Loading branch information
Showing
10 changed files
with
619 additions
and
251 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,38 @@ | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_Reports | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\Reports\Block\Store; | ||
|
||
use Magento\Backend\Block\Store\Switcher as BackendSwitcher; | ||
|
||
/** | ||
* Class Switcher | ||
* @package Mageplaza\Reports\Block\Store | ||
*/ | ||
class Switcher extends BackendSwitcher | ||
{ | ||
/** | ||
* Block template filename | ||
* | ||
* @var string | ||
*/ | ||
protected $_template = 'Mageplaza_Reports::store/switcher.phtml'; | ||
} |
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
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,165 @@ | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_Reports | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Mageplaza\Reports\Block\Store\Switcher; | ||
|
||
/* @var Switcher $block */ | ||
/** @var SecureHtmlRenderer $secureRenderer */ | ||
?> | ||
<?php if ($websites = $block->getWebsites()) : ?> | ||
<div class="store-switcher store-view"> | ||
<span class="store-switcher-label"><?= $block->escapeHtml(__('Scope:')) ?></span> | ||
<div class="actions dropdown closable"> | ||
<input type="hidden" name="store_switcher" id="store_switcher" | ||
data-role="store-view-id" data-param="<?= $block->escapeHtmlAttr($block->getStoreVarName()) ?>" | ||
value="<?= $block->escapeHtml($block->getStoreId()) ?>" | ||
<?= /* @noEscape */ $block->getUiId() ?>/> | ||
<?= /* @noEscape */ | ||
$secureRenderer->renderEventListenerAsTag( | ||
'onchange', | ||
'switchScope(this);', | ||
'#store_switcher' | ||
) ?> | ||
<input type="hidden" name="store_group_switcher" id="store_group_switcher" | ||
data-role="store-group-id" data-param="<?= $block->escapeHtmlAttr($block->getStoreGroupVarName()) ?>" | ||
value="<?= $block->escapeHtml($block->getStoreGroupId()) ?>" | ||
<?= /* @noEscape */ $block->getUiId() ?>/> | ||
<?= /* @noEscape */ | ||
$secureRenderer->renderEventListenerAsTag( | ||
'onchange', | ||
'switchScope(this);', | ||
'#store_group_switcher' | ||
) ?> | ||
<input type="hidden" name="website_switcher" id="website_switcher" | ||
data-role="website-id" data-param="<?= $block->escapeHtmlAttr($block->getWebsiteVarName()) ?>" | ||
value="<?= $block->escapeHtml($block->getWebsiteId()) ?>" | ||
<?= /* @noEscape */ $block->getUiId() ?>/> | ||
<?= /* @noEscape */ | ||
$secureRenderer->renderEventListenerAsTag( | ||
'onchange', | ||
'switchScope(this);', | ||
'#website_switcher' | ||
) ?> | ||
<button | ||
type="button" | ||
class="admin__action-dropdown" | ||
data-mage-init='{"dropdown":{}}' | ||
data-toggle="dropdown" | ||
aria-haspopup="true" | ||
id="store-change-button"> | ||
<?= $block->escapeHtml($block->getCurrentSelectionName()) ?> | ||
</button> | ||
<ul class="dropdown-menu" data-role="stores-list"> | ||
<?php if ($block->hasDefaultOption()) : ?> | ||
<li class="store-switcher-all | ||
<?= !($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) ? | ||
' disabled' : '' ?> | ||
<?= (!$block->hasScopeSelected()) ? ' current' : '' ?>"> | ||
<?php if ($block->getDefaultSelectionName() != $block->getCurrentSelectionName()) : ?> | ||
<a data-role="store-view-id" data-value="" href="#"> | ||
<?= $block->escapeHtml($block->getDefaultSelectionName()) ?> | ||
</a> | ||
<?php else : ?> | ||
<span><?= $block->escapeHtml($block->getDefaultSelectionName()) ?></span> | ||
<?php endif; ?> | ||
</li> | ||
<?php endif; ?> | ||
<?php foreach ($websites as $website) : ?> | ||
<?php $showWebsite = false; ?> | ||
<?php foreach ($website->getGroups() as $group) : ?> | ||
<?php $showGroup = false; ?> | ||
<?php foreach ($block->getStores($group) as $store) : ?> | ||
<?php if ($showWebsite == false) : ?> | ||
<?php $showWebsite = true; ?> | ||
<li class="store-switcher-website | ||
<?= (!($block->isWebsiteSwitchEnabled() && !$block->isWebsiteSelected($website))) ? | ||
' disabled' : '' ?> | ||
<?= ($block->isWebsiteSelected($website)) ? ' current' : '' ?>"> | ||
<?php if ($block->isWebsiteSwitchEnabled() && !$block->isWebsiteSelected($website)) : ?> | ||
<a data-role="website-id" | ||
data-value="<?= $block->escapeHtmlAttr($website->getId()) ?>" href="#"> | ||
<?= $block->escapeHtml($website->getName()) ?> | ||
</a> | ||
<?php else : ?> | ||
<span><?= $block->escapeHtml($website->getName()) ?></span> | ||
<?php endif; ?> | ||
</li> | ||
<?php endif; ?> | ||
<?php if ($showGroup == false) : ?> | ||
<?php $showGroup = true; ?> | ||
<li class="store-switcher-store | ||
<?= (!($block->isStoreGroupSwitchEnabled() && | ||
!$block->isStoreGroupSelected($group))) ? ' disabled' : '' ?> | ||
<?= ($block->isStoreGroupSelected($group)) ? ' current' : '' ?>"> | ||
<?php if ($block->isStoreGroupSwitchEnabled() && | ||
!$block->isStoreGroupSelected($group)) : ?> | ||
<a data-role="store-group-id" | ||
data-value="<?= $block->escapeHtmlAttr($group->getId()) ?>" href="#"> | ||
<?= $block->escapeHtml($group->getName()) ?> | ||
</a> | ||
<?php else : ?> | ||
<span><?= $block->escapeHtml($group->getName()) ?></span> | ||
<?php endif; ?> | ||
</li> | ||
<?php endif; ?> | ||
<li class="store-switcher-store-view | ||
<?= (!($block->isStoreSwitchEnabled() && !$block->isStoreSelected($store))) ? | ||
' disabled' : '' ?> | ||
<?= ($block->isStoreSelected($store)) ? ' current' : '' ?>"> | ||
<?php if ($block->isStoreSwitchEnabled() && !$block->isStoreSelected($store)) : ?> | ||
<a data-role="store-view-id" | ||
data-value="<?= $block->escapeHtmlAttr($store->getId()) ?>" href="#"> | ||
<?= $block->escapeHtml($store->getName()) ?> | ||
</a> | ||
<?php else : ?> | ||
<span><?= $block->escapeHtml($store->getName()) ?></span> | ||
<?php endif; ?> | ||
</li> | ||
<?php endforeach; ?> | ||
<?php endforeach; ?> | ||
<?php endforeach; ?> | ||
<?php if ($block->getShowManageStoresLink() && | ||
$block->getAuthorization()->isAllowed('Magento_Backend::store')) : ?> | ||
<li class="dropdown-toolbar"> | ||
<a href="<?= /* @noEscape */ $block->getUrl('*/system_store') ?>"> | ||
<?= $block->escapeHtml(__('Stores Configuration')) ?> | ||
</a> | ||
</li> | ||
<?php endif; ?> | ||
</ul> | ||
</div> | ||
<?= $block->getHintHtml() ?> | ||
</div> | ||
|
||
<script type="text/x-magento-init"> | ||
{ | ||
"*": { | ||
"Mageplaza_Reports/js/store-switcher": { | ||
"useConfirm": <?= /* @noEscape */ (int) $block->getUseConfirm(); ?>, | ||
"isUsingIframe": <?= /* @noEscape */ (int) $block->isUsingIframe(); ?>, | ||
"switchUrl": "<?= $block->escapeUrl($block->getSwitchUrl()); ?>", | ||
"storeId": <?= /* @noEscape */ (int) $block->getStoreId(); ?> | ||
} | ||
} | ||
} | ||
</script> | ||
<?php endif; ?> |
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
Oops, something went wrong.