Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion Controller/Adminhtml/Mass/Translate/Locked.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function execute()

$this->messageManager->addNotice(
__(
'This option is available in Magefan Translation Extra plan only. Please upgrade at <a href="%1" target="_blank">' .$url. '</a>.',
'This option is available in Magefan Translation Extra plan only.
Please <a href="%1" target="_blank">upgrade plan</a> to use this feature.',
$url . $params
)
);
Expand Down
19 changes: 19 additions & 0 deletions view/adminhtml/layout/cms_block_edit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magefan (support@magefan.com). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.main.actions">
<block class="Magento\Backend\Block\Store\Switcher" name="store_switcher"
template="Magefan_Translation::cms/store-switcher-promo.phtml">
<action method="setUseConfirm">
<argument name="params" xsi:type="string">1</argument>
</action>
</block>
</referenceContainer>
</body>
</page>
19 changes: 19 additions & 0 deletions view/adminhtml/layout/cms_page_edit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magefan (support@magefan.com). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.main.actions">
<block class="Magento\Backend\Block\Store\Switcher" name="store_switcher"
template="Magefan_Translation::cms/store-switcher-promo.phtml">
<action method="setUseConfirm">
<argument name="params" xsi:type="string">1</argument>
</action>
</block>
</referenceContainer>
</body>
</page>
90 changes: 90 additions & 0 deletions view/adminhtml/templates/cms/store-switcher-promo.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php
/**
* Copyright © Magefan (support@magefan.com). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*/

/**
* @var \Magento\Backend\Block\Store\Switcher $block
* @var \Magefan\Community\Api\SecureHtmlRendererInterface $mfSecureRenderer
*/
?>
<?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() ?> />
<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() ?> />
<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() ?> />
<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 disabled current">
<span><?= $block->escapeHtml($block->getDefaultSelectionName()) ?></span>
</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">
<a data-role="mf-promo-switcher" href="#">
<?= $block->escapeHtml($website->getName()) ?>
</a>
</li>
<?php endif; ?>
<?php if ($showGroup == false): ?>
<?php $showGroup = true; ?>
<li class="store-switcher-store">
<a data-role="mf-promo-switcher" href="#">
<?= $block->escapeHtml($group->getName()) ?>
</a>
</li>
<?php endif; ?>
<li class="store-switcher-store-view">
<a data-role="mf-promo-switcher" href="#">
<?= $block->escapeHtml($store->getName()) ?>
</a>
</li>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</ul>
</div>
<?= $block->getHintHtml() ?>
</div>

<?php $script = "
require(['jquery', 'Magefan_Translation/js/mf-upgrade-plan-popup', 'domReady!'], function ($, mfPopup) {
$(\"[data-role='mf-promo-switcher']\").on('click', function (e) {
e.preventDefault();
e.stopPropagation();
mfPopup('Plus or Extra', 'auto-translate', 'store-switcher');
return false;
});
});
"; ?>

<?= /* @noEscape */ $mfSecureRenderer->renderTag('script', [], $script, false) ?>

<?php endif; ?>
2 changes: 1 addition & 1 deletion view/adminhtml/templates/form/js.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if ($block->getRequest()->getParam('store')) {
var a = \$('<a href=\"#\" class=\"mf-locked-feature\" style=\"margin-top:10px;display: inline-block;\">" . $escaper->escapeHtml(__('Translate')) . "</a>').click(function(e){
e.preventDefault();
require(['Magefan_Translation/js/mf-upgrade-plan-popup'], function(mfPopup) {
mfPopup('Plus or Extra', 'auto-translate', 'button');
mfPopup('Plus or Extra', 'auto-translate', 'button-attr');
});
return false;
});
Expand Down