Use Twig to render WooCommerce settings overlay
[MAILPOET-2283]
This commit is contained in:
committed by
Jack Kitterhing
parent
24cc76cfbd
commit
c11b1a78f1
@@ -2,29 +2,29 @@
|
|||||||
|
|
||||||
namespace MailPoet\WooCommerce;
|
namespace MailPoet\WooCommerce;
|
||||||
|
|
||||||
|
use MailPoet\Config\Renderer;
|
||||||
use MailPoet\Features\FeaturesController;
|
use MailPoet\Features\FeaturesController;
|
||||||
use MailPoet\Settings\SettingsController;
|
use MailPoet\Settings\SettingsController;
|
||||||
use MailPoet\WP\Functions as WPFunctions;
|
|
||||||
|
|
||||||
class Settings {
|
class Settings {
|
||||||
|
|
||||||
/** @var FeaturesController */
|
/** @var FeaturesController */
|
||||||
private $features_controller;
|
private $features_controller;
|
||||||
|
|
||||||
|
/** @var Renderer */
|
||||||
|
private $renderer;
|
||||||
|
|
||||||
/** @var SettingsController */
|
/** @var SettingsController */
|
||||||
private $settings;
|
private $settings;
|
||||||
|
|
||||||
/** @var WPFunctions */
|
|
||||||
private $wp;
|
|
||||||
|
|
||||||
function __construct(
|
function __construct(
|
||||||
FeaturesController $features_controller,
|
FeaturesController $features_controller,
|
||||||
SettingsController $settings,
|
Renderer $renderer,
|
||||||
WPFunctions $wp
|
SettingsController $settings
|
||||||
) {
|
) {
|
||||||
$this->features_controller = $features_controller;
|
$this->features_controller = $features_controller;
|
||||||
|
$this->renderer = $renderer;
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
$this->wp = $wp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableWooCommerceSettings() {
|
function disableWooCommerceSettings() {
|
||||||
@@ -37,40 +37,9 @@ class Settings {
|
|||||||
if (!(bool)$this->settings->get('woocommerce.use_mailpoet_editor')) {
|
if (!(bool)$this->settings->get('woocommerce.use_mailpoet_editor')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$woocommerce_template_id = $this->settings->get('woocommerce.transactional_email_id');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style>
|
echo $this->renderer->render('woocommerce/settings_overlay.html', [
|
||||||
/* Hide WooCommerce section with template styling */
|
'woocommerce_template_id' => $this->settings->get('woocommerce.transactional_email_id'),
|
||||||
#email_template_options-description + .form-table {
|
]);
|
||||||
opacity: 0.2;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Position MailPoet buttons over hidden table */
|
|
||||||
.mailpoet-woocommerce-email-overlay {
|
|
||||||
bottom: 320px;
|
|
||||||
left: 0;
|
|
||||||
max-width: 100%;
|
|
||||||
text-align: left;
|
|
||||||
position: absolute;
|
|
||||||
text-align: center;
|
|
||||||
width: 640px;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="mailpoet-woocommerce-email-overlay">
|
|
||||||
<a class="button button-primary" href="?page=mailpoet-newsletter-editor&id=<?php echo $woocommerce_template_id; ?>">
|
|
||||||
<?php echo $this->wp->_x('Customize with MailPoet', 'Button in WooCommerce settings page'); ?>
|
|
||||||
</a>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<a href="?page=mailpoet-settings#woocommerce">
|
|
||||||
<?php echo $this->wp->_x('Disable MailPoet customizer', 'Link from WooCommerce plugin to MailPoet'); ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
views/woocommerce/settings_overlay.html
Normal file
30
views/woocommerce/settings_overlay.html
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<style>
|
||||||
|
/* Hide WooCommerce section with template styling */
|
||||||
|
#email_template_options-description + .form-table {
|
||||||
|
opacity: 0.2;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Position MailPoet buttons over hidden table */
|
||||||
|
.mailpoet-woocommerce-email-overlay {
|
||||||
|
bottom: 320px;
|
||||||
|
left: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
width: 640px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="mailpoet-woocommerce-email-overlay">
|
||||||
|
<a class="button button-primary" href="?page=mailpoet-newsletter-editor&id=<%= woocommerce_template_id %>">
|
||||||
|
<%= _x('Customize with MailPoet', 'Button in WooCommerce settings page') %>
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<a href="?page=mailpoet-settings#woocommerce">
|
||||||
|
<%= _x('Disable MailPoet customizer', 'Link from WooCommerce plugin to MailPoet') %>
|
||||||
|
</a>
|
||||||
|
</div>
|
Reference in New Issue
Block a user