Hide setting behind feature flag

[MAILPOET-2284]
This commit is contained in:
Ján Mikláš
2019-09-24 11:37:42 +02:00
committed by Jack Kitterhing
parent 452552b14a
commit efcd7d6e1d
2 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use MailPoet\AdminPages\PageRenderer;
use MailPoet\Config\Installer; use MailPoet\Config\Installer;
use MailPoet\Config\ServicesChecker; use MailPoet\Config\ServicesChecker;
use MailPoet\Cron\CronTrigger; use MailPoet\Cron\CronTrigger;
use MailPoet\Features\FeaturesController;
use MailPoet\Models\Segment; use MailPoet\Models\Segment;
use MailPoet\Models\Subscriber; use MailPoet\Models\Subscriber;
use MailPoet\Services\Bridge; use MailPoet\Services\Bridge;
@ -37,6 +38,9 @@ class Settings {
/** @var Captcha */ /** @var Captcha */
private $captcha; private $captcha;
/** @var FeaturesController */
private $features_controller;
/** @var Installation */ /** @var Installation */
private $installation; private $installation;
@ -47,7 +51,8 @@ class Settings {
WPFunctions $wp, WPFunctions $wp,
ServicesChecker $services_checker, ServicesChecker $services_checker,
Installation $installation, Installation $installation,
Captcha $captcha Captcha $captcha,
FeaturesController $features_controller
) { ) {
$this->page_renderer = $page_renderer; $this->page_renderer = $page_renderer;
$this->settings = $settings; $this->settings = $settings;
@ -56,6 +61,7 @@ class Settings {
$this->services_checker = $services_checker; $this->services_checker = $services_checker;
$this->installation = $installation; $this->installation = $installation;
$this->captcha = $captcha; $this->captcha = $captcha;
$this->features_controller = $features_controller;
} }
function render() { function render() {
@ -87,6 +93,9 @@ class Settings {
'smtp' => Hosts::getSMTPHosts(), 'smtp' => Hosts::getSMTPHosts(),
], ],
'built_in_captcha_supported' => $this->captcha->isSupported(), 'built_in_captcha_supported' => $this->captcha->isSupported(),
'display_woocommerce_editor' => $this->features_controller->isSupported(
FeaturesController::WC_TRANSACTIONAL_EMAILS_CUSTOMIZER
),
]; ];
$data['is_new_user'] = $this->installation->isNewInstallation(); $data['is_new_user'] = $this->installation->isNewInstallation();

View File

@ -1,4 +1,5 @@
<table class="form-table"> <table class="form-table">
<% if display_woocommerce_editor %>
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="settings[woocommerce_use_mailpoet_editor]"> <label for="settings[woocommerce_use_mailpoet_editor]">
@ -29,6 +30,7 @@
> >
</td> </td>
</tr> </tr>
<% endif %>
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="settings[woocommerce_optin_on_checkout]"> <label for="settings[woocommerce_optin_on_checkout]">