mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add ButtonInterface
Add render hooks to SmartButton
This commit is contained in:
parent
f5163af958
commit
e7e5ebde4e
2 changed files with 45 additions and 0 deletions
40
modules/ppcp-button/src/Assets/ButtonInterface.php
Normal file
40
modules/ppcp-button/src/Assets/ButtonInterface.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* The interface for the button asset renderer.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Button\Assets
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Button\Assets;
|
||||
|
||||
/**
|
||||
* Interface SmartButtonInterface
|
||||
*/
|
||||
interface ButtonInterface {
|
||||
|
||||
/**
|
||||
* Renders the necessary HTML.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function render_buttons(): bool;
|
||||
|
||||
/**
|
||||
* Whether any of the scripts should be loaded.
|
||||
*/
|
||||
public function should_load_script(): bool;
|
||||
|
||||
/**
|
||||
* Enqueues scripts/styles.
|
||||
*/
|
||||
public function enqueue(): void;
|
||||
|
||||
/**
|
||||
* The configuration for the smart buttons.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function script_data(): array;
|
||||
}
|
|
@ -463,6 +463,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
}
|
||||
|
||||
$this->button_renderer( PayPalGateway::ID );
|
||||
do_action( 'woocommerce_paypal_payments_single_product_button_render' );
|
||||
},
|
||||
31
|
||||
);
|
||||
|
@ -483,6 +484,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
id="ppc-button-minicart"
|
||||
class="woocommerce-mini-cart__buttons buttons"
|
||||
></p>';
|
||||
do_action( 'woocommerce_paypal_payments_minicart_button_render' );
|
||||
},
|
||||
30
|
||||
);
|
||||
|
@ -496,6 +498,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
function (): void {
|
||||
$this->button_renderer( PayPalGateway::ID );
|
||||
$this->button_renderer( CardButtonGateway::ID );
|
||||
do_action( 'woocommerce_paypal_payments_payorder_button_render' );
|
||||
},
|
||||
20
|
||||
);
|
||||
|
@ -504,6 +507,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
function (): void {
|
||||
$this->button_renderer( PayPalGateway::ID );
|
||||
$this->button_renderer( CardButtonGateway::ID );
|
||||
do_action( 'woocommerce_paypal_payments_checkout_button_render' );
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -516,6 +520,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
}
|
||||
|
||||
$this->button_renderer( PayPalGateway::ID );
|
||||
do_action( 'woocommerce_paypal_payments_cart_button_render' );
|
||||
},
|
||||
20
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue