mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Extract module flag check
This commit is contained in:
parent
31c90c149e
commit
16fbb5b4d1
2 changed files with 13 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
||||||
* @package WooCommerce\PayPalCommerce
|
* @package WooCommerce\PayPalCommerce
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\PayLaterBlock\PayLaterBlockModule;
|
||||||
use WooCommerce\PayPalCommerce\PluginModule;
|
use WooCommerce\PayPalCommerce\PluginModule;
|
||||||
|
|
||||||
return function ( string $root_dir ): iterable {
|
return function ( string $root_dir ): iterable {
|
||||||
|
@ -66,10 +67,7 @@ return function ( string $root_dir ): iterable {
|
||||||
$modules[] = ( require "$modules_dir/ppcp-save-payment-methods/module.php" )();
|
$modules[] = ( require "$modules_dir/ppcp-save-payment-methods/module.php" )();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( apply_filters(
|
if ( PayLaterBlockModule::is_enabled() ) {
|
||||||
'woocommerce.feature-flags.woocommerce_paypal_payments.paylater_block_enabled',
|
|
||||||
getenv( 'PCP_PAYLATER_BLOCK' ) !== '0'
|
|
||||||
) ) {
|
|
||||||
$modules[] = ( require "$modules_dir/ppcp-paylater-block/module.php" )();
|
$modules[] = ( require "$modules_dir/ppcp-paylater-block/module.php" )();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,17 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||||
* Class PayLaterBlockModule
|
* Class PayLaterBlockModule
|
||||||
*/
|
*/
|
||||||
class PayLaterBlockModule implements ModuleInterface {
|
class PayLaterBlockModule implements ModuleInterface {
|
||||||
|
/**
|
||||||
|
* Returns whether the block should be loaded.
|
||||||
|
*/
|
||||||
|
public static function is_enabled(): bool {
|
||||||
|
return apply_filters(
|
||||||
|
// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||||
|
'woocommerce.feature-flags.woocommerce_paypal_payments.paylater_block_enabled',
|
||||||
|
getenv( 'PCP_PAYLATER_BLOCK' ) !== '0'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue