mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Refactor DisplayManager for admin field display rules centralization.
This commit is contained in:
parent
93f7e5dca6
commit
e31e09f0c7
20 changed files with 619 additions and 273 deletions
|
@ -12,7 +12,7 @@ namespace WooCommerce\PayPalCommerce\Googlepay;
|
|||
use WooCommerce\PayPalCommerce\Googlepay\Helper\PropertiesDictionary;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\FieldDisplayManager;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DisplayManager;
|
||||
|
||||
|
||||
return array(
|
||||
|
@ -32,8 +32,8 @@ return array(
|
|||
return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) );
|
||||
};
|
||||
|
||||
$fields_manager = $container->get( 'wcgateway.field-display-manager' );
|
||||
assert( $fields_manager instanceof FieldDisplayManager );
|
||||
$display_manager = $container->get( 'wcgateway.display-manager' );
|
||||
assert( $display_manager instanceof DisplayManager );
|
||||
|
||||
return $insert_after(
|
||||
$fields,
|
||||
|
@ -58,13 +58,13 @@ return array(
|
|||
'custom_attributes' => array(
|
||||
'data-ppcp-display' => wp_json_encode(
|
||||
array(
|
||||
$fields_manager
|
||||
$display_manager
|
||||
->rule()
|
||||
->condition( 'googlepay_button_enabled', 'equals', '1' )
|
||||
->action( 'googlepay_button_type', 'visible' )
|
||||
->action( 'googlepay_button_color', 'visible' )
|
||||
->action( 'googlepay_button_language', 'visible' )
|
||||
->action( 'googlepay_button_shipping_enabled', 'visible' )
|
||||
->condition_element( 'googlepay_button_enabled', '1' )
|
||||
->action_visible( 'googlepay_button_type' )
|
||||
->action_visible( 'googlepay_button_color' )
|
||||
->action_visible( 'googlepay_button_language' )
|
||||
->action_visible( 'googlepay_button_shipping_enabled' )
|
||||
->to_array(),
|
||||
)
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue