mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
Refactor default settings to match new settings
This commit is contained in:
parent
7f120720cc
commit
2205b1bc1e
2 changed files with 12 additions and 15 deletions
|
@ -142,7 +142,7 @@ return array(
|
||||||
'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways {
|
'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways {
|
||||||
$session_handler = $container->get( 'session.handler' );
|
$session_handler = $container->get( 'session.handler' );
|
||||||
$settings = $container->get( 'wcgateway.settings' );
|
$settings = $container->get( 'wcgateway.settings' );
|
||||||
$settings_status = $container->get( 'wcgateway.settings.status' );
|
$settings_status = $container->get( 'wcgateway.settings.status' );
|
||||||
return new DisableGateways( $session_handler, $settings, $settings_status );
|
return new DisableGateways( $session_handler, $settings, $settings_status );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -195,8 +195,8 @@ return array(
|
||||||
},
|
},
|
||||||
|
|
||||||
'wcgateway.settings' => static function ( ContainerInterface $container ): Settings {
|
'wcgateway.settings' => static function ( ContainerInterface $container ): Settings {
|
||||||
$messaging_locations = $container->get( 'wcgateway.settings.pay-later.messaging-locations' );
|
$default_button_locations = $container->get( 'wcgateway.button.default-locations' );
|
||||||
return new Settings( array_keys( $messaging_locations ) );
|
return new Settings( $default_button_locations );
|
||||||
},
|
},
|
||||||
'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice {
|
'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice {
|
||||||
$state = $container->get( 'onboarding.state' );
|
$state = $container->get( 'onboarding.state' );
|
||||||
|
@ -1283,6 +1283,6 @@ return array(
|
||||||
$settings = $container->get( 'wcgateway.settings' );
|
$settings = $container->get( 'wcgateway.settings' );
|
||||||
assert( $settings instanceof Settings );
|
assert( $settings instanceof Settings );
|
||||||
|
|
||||||
return $this->settings->has( 'smart_button_locations' ) ? $this->settings->get( 'smart_button_locations' ) : array();
|
return $settings->has( 'smart_button_locations' ) ? $settings->get( 'smart_button_locations' ) : array();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,19 +29,19 @@ class Settings implements ContainerInterface {
|
||||||
private $settings = array();
|
private $settings = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of pay later selected default locations.
|
* The list of selected default button locations.
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $pay_later_default_locations;
|
protected $default_button_locations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings constructor.
|
* Settings constructor.
|
||||||
*
|
*
|
||||||
* @param string[] $pay_later_default_locations The list of pay later selected default locations.
|
* @param string[] $default_button_locations The list of selected default button locations.
|
||||||
*/
|
*/
|
||||||
public function __construct( array $pay_later_default_locations ) {
|
public function __construct( array $default_button_locations ) {
|
||||||
$this->pay_later_default_locations = $pay_later_default_locations;
|
$this->default_button_locations = $default_button_locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,14 +109,11 @@ class Settings implements ContainerInterface {
|
||||||
'Pay via PayPal.',
|
'Pay via PayPal.',
|
||||||
'woocommerce-paypal-payments'
|
'woocommerce-paypal-payments'
|
||||||
),
|
),
|
||||||
'button_product_enabled' => true,
|
'smart_button_locations' => $this->default_button_locations,
|
||||||
'button_mini-cart_enabled' => false,
|
|
||||||
'button_cart_enabled' => true,
|
|
||||||
'pay_later_messaging_enabled' => true,
|
'pay_later_messaging_enabled' => true,
|
||||||
'button_enabled' => true,
|
|
||||||
'pay_later_button_enabled' => true,
|
'pay_later_button_enabled' => true,
|
||||||
'pay_later_button_locations' => $this->pay_later_default_locations,
|
'pay_later_button_locations' => $this->default_button_locations,
|
||||||
'pay_later_messaging_locations' => $this->pay_later_default_locations,
|
'pay_later_messaging_locations' => $this->default_button_locations,
|
||||||
'brand_name' => get_bloginfo( 'name' ),
|
'brand_name' => get_bloginfo( 'name' ),
|
||||||
'dcc_gateway_title' => __( 'Credit Cards', 'woocommerce-paypal-payments' ),
|
'dcc_gateway_title' => __( 'Credit Cards', 'woocommerce-paypal-payments' ),
|
||||||
'dcc_gateway_description' => __(
|
'dcc_gateway_description' => __(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue